执行方法后不应该对象a ,b的指向交换吗?求指点!!!
public class Text16 {public static void main(String[] args) { Circle a = new Circle(1); Circle b = new Circle(2); method(a,b); System.out.println("一、a半径:"+a.radius+",b半径:"+b.radius); } public static void method(Circle x,Circle y){ Circle tmp = x; x = y; y = tmp; }} class Circle{ double radiu优艾设计网_设计模板s; Circle(double x){ radius = x; } }
精彩评论