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 difference between calling start() and run() method of thread?
What is string and example?
What do you understand by java?
What are the differences between abstract class and interface?
Why is method overloading not possible by changing the return type in java?
How to convert string to char and vice versa?
What is stack example?
What are the high-level thread states in java programming?
Can a variable be local and static at the same time?
Which method must be implemented by all threads?
Is sizeof a keyword in java programming?
What is use of map in java?
What do bitwise operators do?
What does || || mean in math?
Find the value of a specified element of the array arr[i] where 0 <= i <= n-1