Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

what is the difference between equals method and ==

Answer Posted / chanchal verma

== compares the reference values whether they are pointing to the same object or not. equals() method compares the contents of two objects.
Ex.
String s1=new String("chanchal");
String s2=new String("chanchal");
System.out.println(s1==s2);// prints false
System.out.println(s1.equals(s2));

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Does hashset allow duplicates in java?

1053


What is the flag in java?

993


What is method reference in java?

1057


How many types of equations are there?

961


Hi.... I applied for the post of scientific officer/Engineer-SB(Programmer).Please post the syllabus and sample papers.

1950


What is e java?

1026


Explain about public and private access specifiers?

977


Explain the selection sort algorithm?

1007


What is the difference between a local variable and an instance variable?

1021


What should I import for arraylist in java?

977


What is the difference between @before and @beforeclass annotation?

1016


Is a char always 1 byte?

933


State the merge-sort principle and its time complexity.

918


What is int argc char * argv?

1064


Can each java object keep track of all the threads that want to exclusively access it?

909