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
How do you define a parameter?
How do you know if a value is nan?
What is a container in a gui?
What is meant by nested loop?
What is the difference between size and length in java?
What is difference between hashset and hashmap in java?
How do you define a set in java?
What is the use of default method in interface in java? Explain
What is the nested interface?
What does nullpointerexception mean?
Differentiate between class and structure.
How to pass arraylist to stored procedure in java?
Explain the differences between static and dynamic variables?
Write a regular expression to validate a password. A password must start with an alphabet and followed by alphanumeric characters; its length must be in between 8 to 20.
What is the difference between the reader/writer class hierarchy and the inputstream/outputstream class hierarchy in java programming?