Created
February 15, 2016 02:59
-
-
Save rshepherd/f3b6266614715f3ef15e to your computer and use it in GitHub Desktop.
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
class DoublePointer { | |
String s; | |
public DoublePointer(String s){ | |
this.s = s; | |
} | |
} | |
public class IdentitySwitch { | |
public static void main(String[] args) { | |
DoublePointer dp = new DoublePointer("unchanged"); | |
System.out.println(dp.s); | |
foo(dp.s); | |
System.out.println(dp.s); | |
} | |
public void foo(DoublePointer dp) { | |
dp.s = "changed" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment