What is the output? (Don’t compile or execute this program)
public class Anyonecancode {
static void main(String[] args) {
String s1 = new String("Anyone can Code");
String s2 = new String("Anyone can Code");
StringBuffer sb1 = new StringBuffer("Anyone can Code");
StringBuffer sb2 = new StringBuffer("Anyone can Code");
System.out.println(sb1 == sb2 && s1 == s2);
System.out.println(s1.equals(s2) || sb1.equals(sb2));
}
}
a)
true
true
true
true
b)
false
false
c)
false
true
d)
true
false
e)
other
No comments:
Post a Comment