· StringBuffer objects are mutable.
· StringBuffer class doesn’t override “equals” method .
Hence two different objects are equal if and only if the two references are referring to the same object i.e. it executes the “==” operator on the two references inside the equals method.
· The setLength() method of StringBuffer class sets the length of the StringBuffer object to the specified integer number passed as the parameter to the method . If the number is less than its present length then it truncates the
StringBuffer.for e.g.
StringBuffer s = new StringBuffer(“santosh”);
s.setLength(3);
System.out.println(s); //prints “san“
· Since StringBuffer class doesn’t override “equals” method it doesn’t override “hashCode()” method also.
Hence the hashCode of two StringBuffer objects are equal if only they pass the equals method i.e. the two references must be pointing to the same object. So ,if two StringBuffer objects pass the equals method then the posses