Results 1 to 3 of 3
Like Tree1Likes
  • 1 Post By JosAH

Thread: Do While Loop

  1. #1
    vuzuggu is offline Member
    Join Date
    Oct 2011
    Posts
    19
    Rep Power
    0

    Default Do While Loop

    I can't get a Do while loop working. It just keeps continually looping.
    Is there anything obvious that I am missing?

    Java Code:
    	do  { 
    	 					first.branch();
    	 					terminal.readString("Quit or play again?");
    	 				}  while(end != "quit");

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,440
    Blog Entries
    7
    Rep Power
    20

    Default Re: Do While Loop

    Don't compare Strings (or any object type) with the == or != operators; use the equals( ... ) method instead. Read the API documentation for the String class and also read what the API documentation of the Object class has to say about this.

    kind regards,

    Jos
    vuzuggu likes this.
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    vuzuggu is offline Member
    Join Date
    Oct 2011
    Posts
    19
    Rep Power
    0

Similar Threads

  1. Replies: 2
    Last Post: 11-07-2011, 02:25 AM
  2. Replies: 1
    Last Post: 10-01-2011, 02:12 AM
  3. JTextField loop 2x for-loop WEIRD!
    By Streetproject in forum AWT / Swing
    Replies: 2
    Last Post: 02-16-2011, 05:46 PM
  4. Replies: 5
    Last Post: 04-30-2010, 05:05 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
  •