constructortest.java

来自「kaffe Java 解释器语言,源码,Java的子集系统,开放源代码」· Java 代码 · 共 25 行

JAVA
25
字号
/** * test that a class whose objects are instantiated via newInstance * do in fact have a default, no-arg constructor.  If they don't, * an InstantiationException must be thrown. */public class ConstructorTest {  public ConstructorTest(int i) {}  public static void main(String[]argv)   throws IllegalAccessException, InstantiationException  {    try {	Object o = ConstructorTest.class.newInstance();    } catch (InstantiationException e) {	System.out.println("Success.");	return;    }    System.out.println("Failure.");  }}/* Expected Output:Success.*/

⌨️ 快捷键说明

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