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 / rajender

The Object class equals method refers address comparision.

Person p=new Person();
Person p1=new Person();

if(p.equals(p1){
//is always false.

}


the string class equals method refers content comparision

String p=new String ("java");
String p1=new String ("java");

if(p.equals(p1){
//is always true.

}


Dn't get confusion

Is This Answer Correct ?    5 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How many bytes is a string?

1084


What are the different types of collections in java?

918


Can substring create new object?

1061


Explain scope or life time of local variables in java?

970


How do you define a parameter?

984


Explain the importance of finalize() method.

918


What are the drawbacks for singleton class?

945


Explain about strings in java?

1018


What is meant by interface?

1016


What is the parse method in java?

1054


What is an accessor?

1606


What is the collections api?

992


Explain where variables are created in memory?

964


What is a numeric string?

964


Explain working of call by reference function invoking.

968