this.x=x;
this.y=y; }
public double distance(Point p){
return Math.sqrt((x-p.x)*(x-p.x)+(y-p.y)*(y-p.y)); }
public double distance(int x,int y){
return Math.sqrt((this.x-x)*(this.x-x)+(this.y-y)*(this.y-y)); }
public static double distance(Point x,Point y){
return Math.sqrt((x.x-y.x)*(x.x-y.x)+(x.y-y.y)*(x.y-y.y));
} }
public class hc {
public static void main(String args[]){
Point p=new Point(3,9);
Point a=new Point(7,6);
System.out.println(p.distance(a));
System.out.println(p.distance(5,8));
System.out.println(Point.distance(p,a)); }
class Person{
String name;
char sex; int age;
public Person(String name,char sex,int age){
this.name=name;
this.sex=sex;
this.age=age; } }
class teacher extends Person{
String pro;
String partement;
public teacher(String name,char sex,int age,String pro,String partement){
super(name,sex,age);
this.pro=pro;
this.partement=partement; }
public String toString(){
return name+\ } }
六(2)定义person类,子类student类。
class student extends Person{
String num;
String time;
String zhuanye;
public student(String time,String zhuanye){
super(name,sex,age);
this.num=num;
this.time=time;
this.zhuanye=zhuanye;
name,char sex,int age,String num,String