/ObjectComparision Secret
Created
August 25, 2020 14:48
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Object obj1 = new Object(); | |
Object obj2 = new Object(); | |
boolean result = (obj1 == obj2); | |
System.out.println("Comparing two objects using == operator: " + result); | |
result = obj1.equals(obj2); | |
System.out.println("Comparing two objects using equals method: " + result); | |
obj1 = obj2; | |
result = (educationLoan == constructionLoan); | |
System.out.println("Comparing two references pointing on same object using == operator: " + result); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment