Skip to content

Instantly share code, notes, and snippets.

Created January 10, 2013 17:46
Show Gist options
  • Save anonymous/4504155 to your computer and use it in GitHub Desktop.
Save anonymous/4504155 to your computer and use it in GitHub Desktop.
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; }
}
}
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;
}
}
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