What is difference between “==” and equals()?
“==”: It compares references (memory locations). It does not compares values in the memory location. Hence it is not recommended to find the equality of two objects. It is mostly used to compare primitive types.
equals(): It is used to find the equality of two objects. It actually compares with the values that an object contains.
| Is This Answer Correct ? | 5 Yes | 0 No |
Can we override tostring method in java?
int a=1; float b=1.0; System.out.println(a==b);
13 Answers CTS, Honeywell, McAfee,
What is the difference between a local variable and an instance variable?
How use .contains in java?
"We cannot create an object of interface but we can create a variable of it". Discuss the statement with the help of an example. (Plz help us to provide immediately.)
What type of variable is gender?
What is the generic function?
What is the difference between Error, defect,fault, failure and mistake?
What are the types of strings?
Can a hashset contain duplicates java?
What are the types of statement? explain
What happens when I use / and % with a negative numerator?