Created
November 30, 2012 22:27
-
-
Save 0x000000AC/4179150 to your computer and use it in GitHub Desktop.
Just illustrates .equalsIgnoreCase with some string contatenations
This file contains hidden or 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
/*********************************************** | |
* EqualsIgnoresCaseMethod.java | |
* Aaron P. Clark | |
* | |
* This program compares strings and illustrates the use of the equalsIgnoresCase method | |
***********************************************/ | |
public class EqualsIgnoresCaseMethod | |
{ | |
public static void main(String[] args) | |
{ | |
String animal1 = "Horse"; | |
String animal2 = "Fly"; | |
String newCreature; | |
newCreature = animal1 + animal2; | |
System.out.println(newCreature.equalsIgnoreCase("HorseFly")); //will return true | |
System.out.println(newCreature.equalsIgnoreCase("horsefly")); // will return true | |
} // end main | |
} // end class EqualsIgnoresCaseMethod |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment