Created
August 1, 2013 04:16
-
-
Save BenMcH/6128376 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String one = "One"; | |
if(userInput == one) | |
{ | |
return true; | |
} | |
return false; | |
Assume userInput is a string input by the user (That is "One"). This will return false, while | |
if(userInput.equals(one)) | |
{ | |
return true; | |
} | |
return false; | |
This will return true. | |
You can also do | |
if(userInput.equalsIgnoreCase(one)) | |
{ | |
return true; | |
} | |
return false; | |
will return true ignoring case. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment