| | |
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 |
android api applet application apps array arrays automation awt bidirectional binary birt bluetooth busy_handler(null) chat class classes client code columns component constructor database designadrawingapplicationusingjavajslider draw eclipse editor error errors event eventlistener exception expand fractal game givemetehcodez graphics gui guidancer html ide image inetaddress input integer intellij j2me java javamicroeditionuseofmotionsensor javaprojects jme jni jpanel jtree julia link linux list loop map method methods mobile mobiledevelopmentcreatejar myaggfun netbeans newbie oracle parsing plazmic print problem program programming project recursion scanner screen server set sharepoint size smart sms smsspam sort sortedmaps sql string subclass support swing textfield threads time tree unlimited utility webservices windows







