- String is an immutable that means we can define string but we can not change.
String s2="java smart answers";
- If two or more string object contents are equal then there will be only one object. From the above, both s1 and s2 referring only one object
- In case of "==" , we will check the reference or hash code of the object.
- In case of equals() method, it will check the content of object, it will returns a boolean value i.e true or false.
No comments:
Post a Comment