-
-
-
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
-
-