Skip to content

Instantly share code, notes, and snippets.

@kawakami-o3
Last active December 12, 2015 06:39
Show Gist options
  • Save kawakami-o3/4731016 to your computer and use it in GitHub Desktop.
Save kawakami-o3/4731016 to your computer and use it in GitHub Desktop.
ReferenceTest
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