Last active
December 12, 2015 06:39
-
-
Save kawakami-o3/4731016 to your computer and use it in GitHub Desktop.
ReferenceTest
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
import java.io.*; | |
import java.util.*; | |
public class ReferenceTest { | |
public static class Base { | |
public int value = 0; | |
} | |
public static class Wrapper { | |
private Base base; | |
public Wrapper(Base base) { | |
this.base = base; | |
} | |
public void update(int value) { | |
base.value = value; | |
} | |
} | |
public static void main(String[] args) { | |
Base base = new Base(); | |
Wrapper wrapper = new Wrapper(base); | |
wrapper.update(10); | |
System.out.println("base> " + base.value); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment