Hi,
I have tried both the methods for
String Object.
Somebody is telling only equals() method for String objects.
and compreTo() for Numbers.Whethre it is true?
please help me.
code:
String s1="A";
String s2="B";
System.out.println(s1.equals(s2));
System.out.println(s1.compreTo(s2));
output:
false
some positive number
if we are using compreTo()method on String object how it will compare two objects.
plz help me.
Thanks in advance.