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

What is boolean example?

1020


What is Mutex (Mutual Exclusion Object) ?

1211


What kind of variables can a class consist?

1100


In a container there are 5 components. I want to display the all the components names, how will you do that one?

1081


How garbage collection is done in java?

1103


What is Java Package and which package is imported by default?

1153


Define how destructors are defined in java?

1077


What is anonymous inner class?

1126


What are data types in oop?

1080


What are access specifiers available in java?

1060


What is a singleton puppy?

1040


What are the four pillars of java?

1269


Explain access specifiers?

1241


Is string a datatype?

1037


What modifiers may be used with an inner class that is a member of an outer class in java programming?

1172