Created
August 19, 2012 08:23
-
-
Save ajduke/3393643 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
public class Shape { | |
private void printThis() { | |
// prints invoking object | |
System.out.println(this); | |
} | |
public static void main(String[] args) { | |
Shape shape = new Shape(); | |
// print the shape reference | |
System.out.println(shape); | |
// print the shape reference inside method | |
shape.printThis(); | |
} | |
} | |
// after execution this will print | |
// Shape@19821f | |
// Shape@19821f | |
// meaning that both are similar object |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment