By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,816 Members | 1,332 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,816 IT Pros & Developers. It's quick & easy.

String Not equal Array element.

P: 1
Hi!!

How do I write the if condition to say user string input does not equal the values inside the array. Your response will be appreciated.
3 Weeks Ago #1
Share this Question
Share on Google+
1 Reply


100+
P: 103
Expand|Select|Wrap|Line Numbers
  1. if(!str1.equals(str2)){
  2.   ...
  3. }
  4.  
equals() method compares two strings and if the content of both strings is the same, it returns true. Not operator is used according to the need.
3 Weeks Ago #2

Post your reply

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