package lianxi_1;
import lianxi_1.Point;
class Point{
int x,y;
Point(int a,int b){
x=a;
y=b;
}
}
public class Test20{
public static void main(String args[]){
Point p1,p2;
p1=new Point (56,78);
p2=new Point (34,57);
System.out.println("p1的引用"+p1);
System.out.println("p2的引用"+p2);
System.out.println("p1的x,y坐标:"+p1.x+","+p1.y);
System.out.println("p2的x,y坐标:"+p2.x+","+p2.y);
p1=p2;
System.out.println("p2的引用赋给p1后");
System.out.println("p1的引用"+p1);
System.out.println("p2的引用"+p2);
System.out.println("p1的x,y坐标:"+p1.x+","+p1.y);
System.out.println("p2的x,y坐标:"+p2.x+","+p2.y);
}
} |
|