Created
May 24, 2020 04:29
-
-
Save bangarharshit/bdd5c27738a5823cf66f374965a60021 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
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