public class Equals {
method equals()
public static void main(String[] args)
{
/* integer-type*/
System.out.println(10 == 20);
/* char-type*/
System.out.println('a' == 'b');
/* char and double type*/
System.out.println('a' == 97.0);
/* boolean type*/
System.out.println(true == true);
}
}
equals method:
public class Equals{
public static void main(String[] args)
{
String s1 = new String("HELLO");
String s2 = new String("HELLO");
System.out.println(s1 == s2);
System.out.println(s1.equals(s2));
}
}
No comments:
Post a Comment