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
What is cr keyboard?
Are constructors methods?
What do you mean by constant time complexity?
Does list maintain insertion order java?
Can a class be a super class and a sub-class at the same time? Give example.
Difference between linkedlist and arraylist.
When should you use arraylist and when should you use linkedlist?
What is the difference between this() and super() in java?
Is minecraft 1.15 out?
what is thread? : Java thread
Why collection is called framework in java?
How to retrieve data from database in java using arraylist?
Can we cast any other type to boolean type with type casting?
What is a void method java?
What is difference between wait and notify in java?