package com.hanqi.test;
public class Point {
private double x,y;
public double getX() {
return x;
}
public void setX(double x) {
this.x = x;
}
public Point(double x,double y)
{
this.x=x;
this.y=y;
System.out.println("x="+x+";y="+y);
}
}
//主类
package com.hanqi.test;
public class A {
public static void main(String[] args) {
Point b=new Point(5, 15);
b.setX(10);
System.out.println(b.getX());
}
}
//运行结果
x=5.0;y=15.0
10.0