View Single Post
  #4 (permalink)  
Old 02-11-2008, 03:46 AM
Roughedge's Avatar
Roughedge Roughedge is offline
Member
 
Join Date: Feb 2008
Location: Dundee
Posts: 4
Roughedge is on a distinguished road
Send a message via MSN to Roughedge
Dead easy, just put the '!' before your condition. For example:

Code:
public class TestApp { public static void main(String[] args) { int count = 0; System.out.println("Starting program"); String testString1 = "hello"; String testString2 = "world"; while(!testString1.equals(testString2) && count != 2000) { count++; System.out.println("Number "+count+" This means it is not equal"); } } }
The count is there just to stop the infinite while loop that killed my computer!
__________________
I am so smart that sometimes I don't understand a word I am saying.
Reply With Quote