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...

If I will write
String s=new String("XYZ");
String s1=new String("XYZ");
if(s.equals(s1)){
sop("True");
}
else{
sop("False");
}
This program will give me "True".
But When I am creating my own class suppose
class Employee{
public Employee(String name);
}
Employee e= new Employee("XYZ");
Employee e1 = neew Employee("XYZ");
if(e.equals(e1)){
sop("True");
}
else{
sop("False");
}
Then it will give the output as "False".
Can I know what is happening internally?

Answer Posted / k.packiya lakshmi

In String we can write a string in double quotes and equals is
one method of string but when we creating class it doesn't
know the method of equals.

Is This Answer Correct ?    3 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is ascii code?

1260


What is difference between synchronize and concurrent collection in java?

1061


What are locale settings?

981


What does main method?

975


What is an object’s lock and which object’s have locks?

951


How to sort a collection of custom Objects in Java?

1055


What is sorting in java?

984


What is the difference between Error, defect,fault, failure and mistake?

1201


Explain thread in java?

1160


What are the 7 types of characters?

1075


Under what conditions is an object’s finalize() method invoked by the garbage collector?

1038


What is object class in java?

919


What are jee technologies?

1009


Can java run on google chrome?

1187


What is autoboxing in java?

1060