Created
January 10, 2013 17:46
-
-
Save anonymous/4504155 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Test { | |
public static void main(String[] args) { | |
A a = new A(5); | |
System.out.println(a.getA()); | |
test(a); | |
System.out.println(a.getA()); | |
} | |
public static void test(oba a) | |
{ | |
a.setA(3) ; | |
} | |
} | |
class A { | |
private int _a; | |
public A(int value) { | |
this.a = value; | |
} | |
public double a | |
{ | |
get { return _a; } | |
set { _a = value; } | |
} | |
} |
This file contains hidden or 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 Test { | |
public static void main(String[] args) { | |
A a = new A(5); | |
System.out.println(a.getA()); | |
test(a); | |
System.out.println(a.getA()); | |
} | |
public static void test(A a) | |
{ | |
a.setA(3) ; | |
} | |
} | |
class A { | |
private int a; | |
public A(int value) { | |
this.a = value; | |
} | |
public void setA(int newValue) { | |
this.a = newValue; | |
} | |
public int getA() { | |
return this.a; | |
} | |
} |
This file contains hidden or 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 Test { | |
public static void main(String[] args) { | |
int a = 5; | |
System.out.println(a); | |
test(a); | |
System.out.println(a); | |
} | |
public static void test(int a) { | |
a = 3; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment