Note that there are some explanatory texts on larger screens.

plurals
  1. POJava, cannot receive data from different class file
    text
    copied!<p>I created a user interface that can send some data to a function. However, i encountered some errors along the way. I will explain in details some of my coding. First of all, my function would be called, and some data will be send to another class file.</p> <p>This is my user interface code( I have checked it and it works fine)</p> <pre><code>private void startActionPerformed(java.awt.event.ActionEvent evt) { int x1 = 0; int x2 = 0; test.sbutton(x1, x2);} </code></pre> <p>Next, the sbutton function original from my start.java file. It will call a timer function within.</p> <pre><code>public class Start { Timer timer = new Timer(); public void sbutton(final int x1, final int x2) { timer.scheduleAtFixedRate(new Cost() { public void active() { super.run(x1, x2); new Thread(new Runnable() { public void run() }{ //some function }).start(); } }, 1*1000, 30*1000); </code></pre> <p>The cost.class function code is suppose to receive the x1 and x2. </p> <pre><code>public class Cost extends TimerTask{ // @Override public void run(int x1, int x2) { Calendar rightNow = Calendar.getInstance(); Integer hour = rightNow.get(Calendar.HOUR_OF_DAY); Integer min = rightNow.get(Calendar.MINUTE); if (hour== x1 &amp;&amp; min == x2) {} </code></pre> <p>However, I received an error message and cannot compile. My error message was " Cost is not an abstract and does not overwrite abstract method run()" Could someone identify the error, I have been stuck here for more than 4 hours. All help is appreciated!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload