Why cant we compare two objects with ==,why we should use only .equals() for objects.
We can compare two Strings with (==) when we assign some string value to the String variable,but if we create an object to that strings and compare eachother we cant use(==) operator ,because we can compare only values with(==) operator but as Objects contains references to that variables we cant use(==) operator,hence .equals() is used on references and (==) is useed on values
Showing Answers 1 - 5 of 5 Answers
- What is difference between win XP and win 7
- Is SAP business objects offered as independent bi solutions or is it tied with SAP
- How do we use or operator with desc programming.
- Pulling out the records which are same in two records
- Write the query
- How to remove some keys in arraylist
- Compareto and equals method
- In Java, package does not contain__________
- Operator overloading
- C program to compare two text files
- Aggregations for a system
- Peoplesoft upgrade
- How to record a dynamically changing object in rational functional tester?
- What is the use of command objects and what are the methods provided by the command object ?
- Object recoginition techniques for non unique objects
- Xpath and CSS object identification.
- String s1="you"; string s2=s1+"are"+new string("honest"); in the above code how many objects will be created and which will be available for garbage collection?