Skip to content

Instantly share code, notes, and snippets.

@0x000000AC
Created November 30, 2012 22:27
Show Gist options
  • Save 0x000000AC/4179150 to your computer and use it in GitHub Desktop.
Save 0x000000AC/4179150 to your computer and use it in GitHub Desktop.
Just illustrates .equalsIgnoreCase with some string contatenations
/***********************************************
* 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