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

When does a class need a virtual destructor?

996


What is n in java?

929


Why local variables are stored in stack?

961


What does t in java mean?

970


What are the advantages of user defined functions?

977


What are the access modifiers available in java?

1105


How do you remove duplicates in java?

996


What’s the difference between constructors and other methods?

976


What is difference between final and finally in java?

1065


What is the declaration statement?

923


What is hasnext in java?

1001


What are the differences between string and stringbuffer?

1105


Why do we need singleton class?

986


A person says that he compiled a java class successfully without even having a main method in it? Is it possible?

1035


What is an array length?

883