/*
1.compareTo
2.compareToIgnoreCase
*/
class sm1
{
public static void main(String args[])
{
String str1=new String("Hello");
String str2=new String("Hello");
String str3=new String("hello");
String str4=new String("netx");
System.out.println(str1.compareTo(str2));
System.out.println(str1.compareTo(str3));
System.out.println(str3.compareTo(str2));
System.out.println(str3.compareTo(str4));
System.out.println(str2.compareToIgnoreCase(str3));
}
}
Leave a Reply