Skip to content

Instantly share code, notes, and snippets.

@rshepherd
Created February 15, 2016 02:59
Show Gist options
  • Save rshepherd/f3b6266614715f3ef15e to your computer and use it in GitHub Desktop.
Save rshepherd/f3b6266614715f3ef15e to your computer and use it in GitHub Desktop.
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