|
class Point {
public double x, y;
public void setting(double a, double b) {
x=a;
y=b;
}
public void swap(Point a){
double temp;
temp=a.x;
a.x=a.y;
a.y=temp;
}
public String toString()
{
return ("X좌표 값은 " + x + "이고" + "Y좌표 값은 " + y +"이다,");
}
public static void main (String[] args) {
Point ptr = new Point();
ptr.setting(10.0, 20.0);
System.out.println(ptr.toString());
}
}
---------
double 주는 거는뭔가요??
swap 과 (Point a) <- 설명해주세요;
ptr.swap(ptr) <- ptr 왜 보내졌는지 ..?
|