Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Whats wrong with my code?

  1. #1
    Junior Member
    Join Date
    Jan 2014
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Whats wrong with my code?

    this is my result but i get an error 'this is not an statement' at 'timeDelay == 0; '

    public void act()    
        {    
            if (getObjects(Schip.class).isEmpty())    
            {    
                if (shipsRemaining == 0) Greenfoot.stop();    
                else spawnRandomSchip();    
            }   
     
            private void runTimer()    
            {    
                int timeDelay;  
                if (timeDelay > 50)  
                {  
                    timeDelay == 0;                  
                }  
                int gameTime;  
                timeText.setImage(new GreenfootImage("Time: "+gameTime, 16, java.awt.Color.black, null));  
                if (gameTime == 60)  
                {  
                    Greenfoot.stop();  
                }  
            }  
        }


  2. #2

  3. #3
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,520
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: Whats wrong with my code?

    Welcome to the forum! Please read this topic to learn how to post code in code or highlight tags and other useful info for newcomers.

  4. #4
    Member llowe29's Avatar
    Join Date
    Jul 2013
    Posts
    116
    My Mood
    Tired
    Thanks
    9
    Thanked 5 Times in 5 Posts

    Default Re: Whats wrong with my code?

    "==" is a comparison operator not one for assignment

Similar Threads

  1. Can anyone see whats wrong with this code
    By javapol in forum What's Wrong With My Code?
    Replies: 5
    Last Post: February 27th, 2013, 03:59 PM
  2. help me with a code, whats wrong?
    By Heizzer10 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: October 17th, 2012, 11:30 AM
  3. Can someone see whats wrong with my code, please?
    By DJBENZ10 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: July 11th, 2012, 08:54 PM
  4. Whats wrong with my code?
    By Bryan29 in forum What's Wrong With My Code?
    Replies: 8
    Last Post: October 5th, 2011, 09:12 AM
  5. Whats Wrong with this code?
    By whattheeff in forum What's Wrong With My Code?
    Replies: 1
    Last Post: March 9th, 2011, 10:59 PM