| | |
String.equals()
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() | View First Unread |
•
•
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: JAVA ATM Home problem
- Next Thread: Removing strings in java
| Thread Tools | Search this Thread |
Tag cloud for Java
addressbook android api apple applet application arguments array arrays automation binary bluetooth button calculator chat class classes client code columns component converter database draw eclipse error errors event exception file fractal ftp game givemetehcodez graphics gridlayout gui helpwithhomework html ide image inetaddress input integer j2me japplet java javaprojects jme jmf jni jpanel julia link linux list loop map method methods midlethttpconnection mobile netbeans newbie number objects openjavafx oracle php print problem program programming project projects recursion rim scanner screen server set signing size smart sms socket sort sql storm string support swing test threads time tree unlimited variablebinding webservices windows








