View Single Post
  #2 (permalink)  
Old 06-07-2007, 09:41 PM
John's Avatar   
John John is offline
Co-Administrator
 
Join Date: Jul 2006
Age: 20
Posts: 3,433
Last Blog:
Google Web Toolkit
Rep Power: 20
John has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond repute
Send a message via AIM to John Send a message via MSN to John
Default

In Java strings are not primitive data types, they are objects, and can therefor not be compared using the binary operator [wingedpanther may know why]. When comparing strings in Java use the .equals() function.

Code:
if(txtField.getText().equals(STRING_VAR)){
    somethingHappens();
}

Last edited by John; 06-07-2007 at 09:46 PM.
Reply With Quote