what is the difference between equals method and ==
Answer Posted / subrahmanyam
== is userd to compare both are of same type
equals is used to compare both are of same contents
EX:
String s1="raju";
String s2=new String("raju");
if(s1.equals(s2))
System.out.println(" if(s1.equals(s2)"); //true
if(s1==s2)
System.out.println(" s1==s2"); //false
Is This Answer Correct ? | 62 Yes | 14 No |
Post New Answer View All Answers
Explain what access modifiers can be used for variables?
Difference between comparator and comparable in java?
What is an error in java?
What is the difference between serial and throughput garbage collector?
What is super?
Why inputstreamreader is used in java?
Does substring create a new object?
What are the four integer types supported by java?
What does java ide mean?
Which api is provided by java for operations on set of objects?
how to open and edit XML file in Weblogic???
How does the java compiler work?
Does java support multiple inheritance or not?
What the difference is between execute, execute Query, execute Update?
Which class represents the socket that both the client and server use to communicate with each other?