What is difference between “==” and equals()?



What is difference between “==” and equals()?..

Answer / 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

More Core Java Interview Questions

How do you download stubs from Remote place?

0 Answers  


Can we override compareto method?

0 Answers  


What is OOPs & Why?

3 Answers  


What is hash table in java?

0 Answers  


"we cannot create an object of interface but we can create a variable of it".diacuss the statement with the help of an example.

2 Answers  






What is the use of flag?

0 Answers  


What are the 5 types of research methods?

0 Answers  


What is a function in java?

0 Answers  


relation between list and linked list

1 Answers   Infosys,


How can you read an integer value from the keyword when the application is runtime in java? example?

0 Answers   HCL,


What is collections framework?

0 Answers  


i need example for java abstraction. where we use abstraction and why we need abstraction.

2 Answers   Oracle,


Categories