代码: public class Point { double x,y,r; public Point() { // TODO Auto-generated constructor stub this.x=0; this.y=0; this.r=1; } public Point(double x, double y, double r) { this.x = x; this.y = y; this.r = r; } public boolean overlap(Point p) { return Math.sqrt((p.x-this.x)*(p.x-this.x)+(p.y-this.y)*(p.y-this.y))<(p.r+this.r); } public static void main(String[] args) { // TODO Auto-generated method stub Point p1=new Point(); Point P2=new Point(1,1,0.5); Point P3=new Point(3,8,1); System.out.println(p1.overlap(P2)); System.out.println(p1.overlap(P3)); System.out.println(P2.overlap(P3)); } } 运行结果: true false false