⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ex2.java

📁 JAVA编程思想第四版英文原版习题答案. pdf原版的
💻 JAVA
字号:
// interfaces/Ex2.java
// TIJ4 Chapter Interfaces, Exercise 2, page 315
// Create a class as abstract without including any abstract methods, and verify
// that you cannot create any instances of that class.

abstract class Nogo1 {
	Nogo1() { System.out.println("Nogo1()"); }
}

abstract class Nogo2 {}

class Go1 extends Nogo1 {
	Go1() { System.out.println("Go1()"); }
}

public class Ex2 {
	public static void main(String[] args) {
		// Nogo1 and Nogo2 cannot be instantiated:
		// Nogo1 ng1 = new Nogo1();
		// Nogo2 ng2 = new Nogo2();
		// But Nogo1() constructor called during instatiation of child: 	
		Go1 g1 = new Go1();
	}
}

⌨️ 快捷键说明

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