difference between == and equals() – Computer Sir Ki Class

Login


Lost your password?

Don't have an account ?
Register (It's FREE) ×
  

Login
[lwa]



Exam Questions-ICSE2016-02A #JAVA#4220    siteicon   siteicon  

Problem Statement - difference between == and equals()

State the difference between == operator and equals() method.

Solution

TC++ #4220

The == (equals to comparison operator) compares the value of variables, while the equals() method is meant to compare if two objects are pointing to same memory location. In practical usage equals method are often overloaded to return true or false.


Share

sunmitra| Created: 31-Mar-2018 | Updated: 16-Apr-2019|ICSE2016






Back