Please help me about this mock question.
public class StringBufferTest {
public static void main(
String args[]) {
StringBuffer sb1 = new StringBuffer("Prakash");
StringBuffer sb2 = new StringBuffer("Prakash");
if(sb1.equals(sb2)) System.out.println("Equal");
else
System.out.println("Not Equal");
}
}
How come the answer is "Not Equal". I have coimpiled and tested it also.
I know that equals compares content but in this case why its not doing that.