Filter by Tags

Difference between == and .equal() methods in Java

Votes

0

0 0

What is the main difference between == and .equals() method in Java. In which situation should these methods be used.

Open E-School
Posted on : Fri, Jan 19, 2018
Views : 84
Comments

Ask Question

If you want to ask question you must LogIn or SignUp
Login SignUp

Answers (1)


0

In Java == operator is used for reference checking and .equal() method is used for value checking. This means that .equal() method will always give true if the value of two objects is the same and == will always give true if the objects being compared are the same.

For more details please go through this article

http://openeschool.com/tutorial/3202/what-is-the-best-way-to-compare-strings-in-java 

Ravinder Singh
Fri, Jan 19, 2018
Loading...
Comments

Edit Answer

Submit
This answer will permanently deleted. Do you really want to delete this Answer ?
To Add your Answer Please
LogIn | SignUp

Quick Links

E-Magazines

@

Total Followers
Study Group Created
Study Group Joined
Following Teacher
Following Organization
Blog Articles Added
Questions Asked
Questions Answered
Jobs Posted
Total Members in Group
Questions asked by members
Tasks added in this Group

Please wait..

Ok

Login to Open ESchool OR Create your account    Login   SignUp