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

Can singleton class be cloned?

1052


Is {a, n, d} a palindrome? If you are given a random string, is it a palindrome or not?

1134


What is complexity in java?

1045


What string is utf8?

997


Explain the term virtual machine?

1047


What are the library functions in java?

1045


Does java allow overriding static methods ?

1112


What are the two ways to create a thread?

1008


How do I start learning java?

1066


What is a boolean expression in java?

1022


What is scope & storage allocation of static, local and register variables? Explain with an example.

1014


What is static keyword in java?

1001


Which method must be implemented by all threads?

1265


How do you sort data in java?

953


Is ++ operator thread-safe in java?

1183