Comparing Strings
String s1, s2;
String s3 = "hello";
s1 = new String("hello");
s2 = new String("hello");
String s4 = s1;
(s1 == s2)
(s1 == s3)
(s1 == "hello")
(s1 == s4)
(s1.equals(s2))
(s1.equals(s3))
(s1.equals("hello"))
(s3 == "hello")
Previous slide
Next slide
Back to first slide
View graphic version