Results 1 to 5 of 5
  1. #1
    knoxy5467 is offline Member
    Join Date
    Jun 2011
    Posts
    2
    Rep Power
    0

    Default i need to + one to gamelength during this proccess but it needs to be a statement

    Java Code:
    class GCTask extends TimerTask {
      public void run() {
          gamelength + 1 ;  // this needs to be a statement please help
        System.gc();
      }
    }
    
    
    
            
                    
    }
    public class timer {
      public static void main(String[] args) {
        Timer timer = new Timer();
        GCTask task = new GCTask();
        timer.schedule(task, 1000, 1000);
        int counter = 1;
        while (true) {
          try {
            Thread.sleep(500);
          } catch (InterruptedException e) {
          }
        }
      }

  2. #2
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,585
    Rep Power
    12

    Default

    A statement doing what? What is the line supposed to do? (at the moment it adds one and gamelength then does nothing with the resulting sum)

  3. #3
    knoxy5467 is offline Member
    Join Date
    Jun 2011
    Posts
    2
    Rep Power
    0

    Default

    basically what it's going to do is it's going to be in a loop that starts when the on button is pushed and it gets +1 for each second that passes until the off button is pushed and this info is put live into a formula that creates an output that is desplayed in a text field

  4. #4
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,585
    Rep Power
    12

    Default

    Yes, but none of that says what the statement you wish to write is supposed to do. (Not the context of the statement, not that "it" - whatever it is - gets something, not what later happens to some "info")

    Is it - the statement - supposed to assign a value to a variable, perhaps? In java you use = for that:

    Java Code:
    foo = someExpression;

  5. #5
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,800
    Rep Power
    7

Similar Threads

  1. if statement help
    By Mrlowrider in forum New To Java
    Replies: 1
    Last Post: 04-20-2011, 08:14 PM
  2. Help with If and Else statement
    By Aionia in forum New To Java
    Replies: 18
    Last Post: 03-13-2011, 08:50 AM
  3. add an If Else statement and......uh????
    By sonny in forum New To Java
    Replies: 6
    Last Post: 03-04-2010, 07:57 PM
  4. for statement help
    By helpisontheway in forum New To Java
    Replies: 5
    Last Post: 11-14-2009, 05:14 PM
  5. Statement or Prepared Statement ?
    By paty in forum JDBC
    Replies: 3
    Last Post: 08-01-2007, 05:45 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •