1 public class Param_test { 2 3 public void change(Point point) { 4 5 point.x = 3; 6 point.y = 4; 7 8 } 9 10 public static void main(String[] args) { 11 Param_test pt = new Param_test(); 12 Point point = new Point(); 13 pt.change(point); 14 System.out.println(point.x); 15 System.out.println(point.y); 16 } 17 18 } 19 20 class Point { 21 22 int x; 23 int y; 24 }
1 public class Param_test { 2 public void change(Point point) { 3 point = new Point(); 4 point.x = 3; 5 point.y = 4; 6 7 } 8 9 public static void main(String[] args) { 10 Param_test pt = new Param_test(); 11 Point point = new Point(); 12 pt.change(point); 13 System.out.println(point.x); 14 System.out.println(point.y); 15 } 16 17 } 18 19 class Point { 20 21 int x; 22 int y; 23 }