| | |
String.equals()
![]() |
•
•
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 |
6 @param actuate android api applet application arc array arrays automation balls binary bluetooth bold business byte c++ chat class client code codesnippet collections compare component coordinates database defaultmethod detection doctype dragging ebook eclipse educational error file fractal froglogic game givemetehcodez graphics gui guitesting helpwithhomework hql html ide ideas image ingres input integer internet intersect invokingapacheantprogrammatically j2me java javaexcel javaprojects jni jpanel jtextarea julia linux list map method methods mobile mysql netbeans newbie nextline parameter php pong problem program programming project recursion recursive scanner sell server set sms sort sql string sun swing swt terminal threads tree web websites windows







