Answer Posted / javamasque
“==”: It compares references (memory locations). It does not compares values in the memory location. Hence it is not recommended to find the equality of two objects. It is mostly used to compare primitive types.
equals(): It is used to find the equality of two objects. It actually compares with the values that an object contains.
| Is This Answer Correct ? | 5 Yes | 0 No |
Post New Answer View All Answers
When can you say a graph to be a tree?
What is the difference between state-based unit testing and interaction-based unit testing?
Can a class be declared as static?
What is the declaration statement?
What is the difference between C++ and Java and your preferences?
How many techniques can be employed to create a string object?
What is the difference between processes and threads?
How are variables stored?
What is finalize()?
How do you know if a value is nan?
Explain listiterator and methods in listiterator?
What does replaceall do in java?
What is the purpose of encapsulation?
Can we sort hashmap in java?
What is the major drawback of internal iteration over external iteration?