?? thisdemo.java
字號:
class Point
{ protected int x,y;
Point(int a,int b)
{ setPoint(a,b);
}
public void setPoint(int a,int b)
{ x=a;
y=b;
}
}
class Line extends Point
{ protected int x,y;
Line(int a,int b)
{ super(a,b);
setLine(a,b);
}
public void setLine(int x,int y)
{ this.x=x+x;
this.y=y+y;
}
public double length( )
{ int x1=super.x,y1=super.y,x2=this.x,y2=this.y;
return Math.sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
}
public String toString( )
{ return "直線端點:["+super.x+"."+super.y+"]["+x+"."+y+"]直線長度:"+this.length( );
}
}
public class ThisDemo
{ public static void main(String args[ ])
{ Line line=new Line(20,20);
System.out.println("\n"+line.toString( ));
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -