| | |
String.equals()
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Jan 2008
Posts: 32
Reputation:
Solved Threads: 0
No I know that in order to compare a String you have to call its method .equals but how I check if a String is NOT equal to something? Will it be something like if ("hello" != String.equal())?? or is there a special method?
I know I'm being dumb here lol but after some researching I can't find the answer.
Thanks
I know I'm being dumb here lol but after some researching I can't find the answer.
Thanks
•
•
Join Date: Feb 2008
Posts: 28
Reputation:
Solved Threads: 1
two strings are equal in case of equals method if both strings that you are comparing have the same characters and have the same case such as "hello".equals("hello") will return true as both the strings have the same characters h,e,l,l,o and they do have the same length and also have the same case.
Now change the case of h to H i.e write "Hello".equals("hello") this will return false which shows that the strings are not equal.
understood.
Now change the case of h to H i.e write "Hello".equals("hello") this will return false which shows that the strings are not equal.
understood.
0
#5 Oct 20th, 2009
•
•
•
•
Use( ! "hello".equals(someString) )edit: Yes, same thing striker just posted

•
•
Join Date: Oct 2007
Posts: 11
Reputation:
Solved Threads: 0
0
#7 Oct 20th, 2009
can i use like these ?
String a = "Hello";
if ( a == "Hello" )
am php programmer .. never try java.
thx .
String a = "Hello";
if ( a == "Hello" )
am php programmer .. never try java.
thx .
http://www.jobyess.com - My test web for SEO
•
•
Join Date: Oct 2007
Posts: 11
Reputation:
Solved Threads: 0
0
#9 Oct 20th, 2009
http://www.jobyess.com - My test web for SEO
![]() |
Similar Threads
- Java's String Tokenizer (Java)
- switch statement on String in Java (Java)
- hi.. string compare (Java)
- difference b/w equals and == (Java)
- Confused about reading text files (Java)
- Please help me compare strings (Java)
- Cannot incorporate equals method for a yes or no answer. (Java)
- string translation (Java)
Other Threads in the Java Forum
- Previous Thread: String to char
- Next Thread: Card
| Thread Tools | Search this Thread |
911 actionlistener addressbook android api append applet application array arrays automation binary bluetooth character chat class classes client code component consumer csv database desktop draw eclipse error event exception fractal ftp game givemetehcodez graphics gui html ide image input integer j2me japplet java javaarraylist javac javaee javaprojects jmf jni jpanel julia linked linux list loop map method methods mobile netbeans newbie objects online oracle oriented panel print printf problem program programming project projects properties recursion replaydirector reporting researchinmotion robot rotatetext rsa scanner screen se server set size sms sort sql string swing template test threads time tree ubuntu update windows







