//创建点对象
class Point{
private int x;
private int y;
Point(int x,int y){
this.x = x;
this.y = y;
}
public int getX(){
return x;
}
public int getY(){
return y;
}
}
//创建圆对象
class Circle{
private int r;//圆的半径
Circle(int r){
this.r = r;
}
int judge(Point p){
int xxyy = p.getX() * p.getX() + p.getY() * p.getY();
int rr = this.r * this.r;
if(xxyy > rr){
return 1;
}else if(xxyy < rr){
return 0;
}else{
return -1;
}
}
}
//测试:判断点与圆之间的关系
public class thisDemo{
public static void main(String[] args){
Point p = new Point(3,4);//点的位置
Circle c = new Circle(5);//创建圆
int ret = c.judge(p);
System.out.println(ret);
}
}