Java Programming - Objects and Collections - Discussion
Discussion Forum : Objects and Collections - General Questions (Q.No. 2)
2.
Which class does not override the equals() and hashCode() methods, inheriting them directly from class Object?
Answer: Option
Explanation:
java.lang.StringBuffer is the only class in the list that uses the default methods provided by class Object.
Discussion:
15 comments Page 1 of 2.
Vidya said:
2 decades ago
can u give me the clear discription?
Firat said:
1 decade ago
Other classes are wrapper classes and override equals() and hashCode() methods. The StringBuffer does not override these methods.
SArfaraz Ahamad said:
1 decade ago
But String class is not Wrapper class.
Pankaj kalra said:
1 decade ago
Why string buffer or string builder not override these 2 mehtods ?
Ghost said:
1 decade ago
@Sarfaraz Ahamad.
All wrapper classes and String class overrides the equals() and hashCode().
@Pankaj Kalra.
string buffer or string builder are not classes .
The classes are StringBuffer and StringBuilder. Please follow java naming conventions.
All wrapper classes and String class overrides the equals() and hashCode().
@Pankaj Kalra.
string buffer or string builder are not classes .
The classes are StringBuffer and StringBuilder. Please follow java naming conventions.
Manoj said:
1 decade ago
Please could you give full description?
Why StringBuffer class does not support direct overriding these 2 methods?
Why StringBuffer class does not support direct overriding these 2 methods?
Monika said:
1 decade ago
I think StringBuffer just uses these two methods as they are provided from Object class. The other three classes override them.
(1)
G Sunil Kumar said:
1 decade ago
Why the special behavior for StringBuffer class only?
Narasimha said:
1 decade ago
I am confusing why StringBuffer and StringBuilder are not able to overriding these two methods equals and hashcode() methods. Please could you clarify the same. Thank you.
Asdf said:
1 decade ago
I think StringBuffer and StringBuilder are class use to make string immutable.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers