constructiondemo.java

来自「JAVA的一些基础教程」· Java 代码 · 共 32 行

JAVA
32
字号
class 房子{
	int 面积;
	public 房子(int 面积)
	{
		this.面积 = 面积;
		System.out.println("房子的构造函数被调用");
	}
}
class 楼房 extends 房子
{
	public 楼房()
	{
		System.out.println("楼房的构造函数被调用");
	}
}

class 写字楼 extends 楼房
{
	public 写字楼()
	{
		super();
		System.out.println("写字楼的构造函数被调用");
	}
}

public class ConstructionDemo
{
	public static void main(String arg[])
	{
		写字楼 中信 = new 写字楼();
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?