执行方法后不应该对象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 radius;
Circle(double x){
radius = x;
}
}
MMMHUHU
DIEA
相关分类