public class
Test {
String s1;
String s2 = "hello";
String s3;
Test () {
s1 = "hello";
}
public static void main(String[] args) {
(new Test ()).f();
}
{
s3 = "hello";
}
void f() {
String s4 = "hello";
String s5 = new String("hello");
assert(s1.equals(s2)); // (1)
assert(s2.equals(s3)); // (2)
assert(s3 == s4); // (3)
assert(s4 == s5); // (4)
}
}
it is not showing error in line 4. can you explain why?