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
Write a code to create a trigger to call a stored procedure
What is volatile data type?
What all access modifiers are allowed for top class ?
How do you convert an int to a string in java?
Can private class be extended java?
What initialize variables?
Can we sort set in java?
What are the new features in java 8?
Why is it called a string?
What are the topics in core java?
What is the intersection and union methods?
How many inner classes can a class have?
Explain how hashmap works?
What is string substring?
How can we find the actual size of an object on the heap?