📄 4-6.txt
字号:
class ColorPrint exends Point //类ColorPoint是类Point的直接子类,
//类Point是类ColorPoint的直接父类;
//类Object是为ColorPoint的缺省父类,但不是直接父类
{
int color;
public static void draw() //复盖了父类的draw()类
{ System.out.println("ColorPoint: a color point.")
}
}
class MapPoint extends ColorPoint //类MapPoint是类Colorpoint的直接子类
{ //类ColorPoint是类MapPoint的直接父类;
//类Object、Point是为MapPoint的父类,但不是直接父类
String name; //地图上的点有自己的名字,如城市名
public static void draw() ////复盖了父类的draw()类
{ System.out.println("MapPoint: a map color point.")
}
}
public class SuperSub
{
public static void main(String args[])
{
Point.draw();
Colorpoint.draw();
MapPoint.draw();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -