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

Does windows 10 need java?

1011


What is a blocking method in Java?

1153


What is meant by flickering?

1037


What is the difference between break and continue statements?

991


enlist some features of jdk.

912


What happens when I use / and % with a negative numerator?

1007


Can you explain the usages of class.forname()?

1019


Implementations of set interface?

965


What does int [] mean in java?

987


How do listeners work?

990


What are the benefits of operations?

906


What is the functionability stubs and skeletons?

1109


What is a singleton factory?

918


What is the default size of arraylist in java?

1035


What is variable explain with example?

1006