469,270 Members | 1,103 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,270 developers. It's quick & easy.

Testing if a string is NOT equal to...

Hi, I'm currently coding a Java program for a University coursework, and I'm a little bit stuck.

How do I find out if a string is NOT equal to a certain value? I know to test if it is equal, you use .equals, but I have no idea how to test if it's not equal to.

Thanks
Aug 6 '08 #1
2 120647
Laharl
849 Expert 512MB
Use ! to negate a boolean expression, in this case !str1.equals(str2).
Aug 6 '08 #2
Wow, thanks for the speedy reply,t hat works perfect :) Thanks again
Aug 6 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

7 posts views Thread by Bart Nessux | last post: by
5 posts views Thread by Pavils Jurjans | last post: by
11 posts views Thread by Dan Bass | last post: by
3 posts views Thread by Locia | last post: by
2 posts views Thread by TimothyBarbour | last post: by
4 posts views Thread by squash | last post: by
3 posts views Thread by bussiere maillist | last post: by
sumittyagi
4 posts views Thread by sumittyagi | last post: by
20 posts views Thread by Xcriber51 | last post: by
4 posts views Thread by =?Utf-8?B?ZmFpcnl2b2ljZQ==?= | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.