whats the difference between == and .equal ?
Answer Posted / nagaraju
== it is relational operator to copares the values
.equals() is a method to compares the two strings whether
they are equal or not.
if(a==b)
System.out.println("both are equal");
object.equals(string1,string2)
System.out.println("strings are same");
| Is This Answer Correct ? | 24 Yes | 6 No |
Post New Answer View All Answers
What do you mean by scope of variable?
Can constructor be inherited?
Why string is not thread safe?
What is mean by encoding?
What is casting in java programming?
What is double in java?
Is it possible to write a regular expression to check if string is a number?
Explain about the interpreter in java?
How many inner classes can a class have?
What is prefix of a string?
Explain about join() method?
What is a subsequence of a string?
Java is Pass by Value or Pass by Reference?
What is the java project architecture?
Does importing a package imports its sub-packages as well in java?