Skip to content

Instantly share code, notes, and snippets.

@bangarharshit
Created May 24, 2020 04:29
Show Gist options
  • Save bangarharshit/bdd5c27738a5823cf66f374965a60021 to your computer and use it in GitHub Desktop.
Save bangarharshit/bdd5c27738a5823cf66f374965a60021 to your computer and use it in GitHub Desktop.
public class Arbit {
public static void main(String[] args) {
Arbit arbit = new Arbit();
Container container = new Container();
container.a = 7;
container.b = 6;
arbit.change(container);
int d = 5;
arbit.changeInt(d);
System.out.println(container);
}
private void change(Container container) {
container.a = 9;
container = new Container();
}
private void changeInt(int i) {
i = 7;
}
public static class Container {
private int a;
private int b;
@Override
public String toString() {
return "Container{" +
"a=" + a +
", b=" + b +
'}';
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment