whats the difference between == and .equal ?

Answer Posted / jai

== this is equal to it mainly compares only the values of
the object if both are equal it returns true or else false


eg. a=10,b=20
if (a==b)
it will return false



for the same case it will return false for .equals since
.equals will check only that the objects refr to the same
reference (address) of the instance


clear

Is This Answer Correct ?    1 Yes 10 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are multiple inheritances?

585


What is default exception handling in java?

577


What is the difference between compare and compareto in java?

491


What is void data type?

580


How do you reverse a list?

556






What is a qualifier in a sentence?

529


Why is stringbuffer faster than string?

493


How does thread synchronization occurs inside a monitor? What levels of synchronization can you apply?

543


What is a layout manager and what are different types of layout managers available in java awt?

729


What is the purpose of the strictfp keyword?

609


Do I need java for windows 10?

552


What is * argv?

707


Why is sizeof not a function?

551


What checkbox method allows you to tell if a checkbox is checked?

539


Assume a thread has lock on it, calling sleep() method on that thread will release the lock?

627