whats the difference between == and .equal ?
Answer Posted / james rajesh
One database tale contain id and name...mostly id's are in int and name's are in String...if u want to compare with id and one number means u use ==
like, if(id==1)
if u want to compare name means u use .equals
like, if(name.equals("Bangalore"))
So point of view,
== used to compare integer
.equals used to compare String
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is var keyword ?
What is class array in java?
Can I extend singleton class in java?
What state does a thread enter when it terminates its processing in java programming?
what is thread? What are the high-level thread states? : Java thread
What about abstract classes in java?
What are aggregate functions explain with examples?
What is increment in java?
Difference between serialization and deserialization in java?
Why does java not support pointers?
Can we overload the main() method?
What is a JAR file?
What is the difference between the boolean & operator and the && operator in java programming?
Write a program to check string is palindrome without using loop?
How does linkedhashmap work in java?