抽象类A和抽象类Test的定义如下: abstract class A { abstract int getInfo() { } } public class Test extends A { private int a = 0; public int getInfo() { return a; } public static void main(String args[]) { Test b= new Test(); System.out.println(b.getInfo()); } } 关于上述代码说明正确的是_________
举一反三
- 下列代码的执行结果是 。public class Test {public int aMethod(){static int i=0;i++;System.out.println(i);}public static void main(String args[ ]){Test test = new Test();test.aMethod();}}
- 有如下代码,则该程序运行时输出结果是。 class Test{ static int i=0; public void show() { i++; System.out.println(i); } } public class Demo { public static void main(String[] args) { Test test=new Test(); test.show(); } }
- 下列类的定义中哪些是合法的抽象类?( ) A: sealed abstract class c1{abstract public void test() {} B: abstract sealed public viud test(); C: abstract class c1 { abstract void test(); //test()默认为私有,不合法 D: abstract class c1 {abstract public void test(); }
- 分析程序,将代码补充完整public class Test { ________ __ int k=5; public static void main(String[] args){ Test t1=new Test(); t1.k++; System.out.println(Test.k); }}
- 已知有下列类的说明,则下列哪个语句是正确的?public class Test {private float f = 1.0f;int m = 12;static int n=1;public static void main(String arg[]) {Test t = new Test();}}