读代码:public class ExceptionTest {class TestException extends Exception {}public void runTest () throws TestException {}public void test () /* Point X*/ {runTest ();}}第4行//point X 位置, 加哪行代码能让代码可编译
相似题目
-
10. public class ClassA { 11. public void count(int i) { 12. count(++i); 13. } 14. } And: 20. ClassA a = new ClassA(); 21. a.count(3); Which exception or error should be thrown by the virtual machine?()
-
阅读以下代码: public class Test{ public static void main(){ System.out.println(“x=”+x); } } 请问,代码运行的结果是?()
-
public class TestOne { public static void main (String[] args) throws Exception { Thread.sleep(3000); System.out.println(”sleep”); } } What is the result?()
-
现有: public class Pet() public class Cat extends Pet{) 执行代码 Cat c- new Cat(); Pet p= (Pet)c; 后下列哪项是正确的?()
-
public class Test{ public static void main( String[] argv ){ // insert statement here } } Which statement, inserted at line 3, produces the following output?() Exception in thread “main” java.lang.AssertionError: true at Test.main(Test.java:3)
-
现有: public class Pet() public class Cat extends Pet{) 执行代码 Cat c- new Cat(); Pet p= (Pet)c; 后下列哪项是正确的?()
-
public class Foo { static int[] a; static { a[0]=2; } public static void main( String[] args) {} } Which exception or error will be thrown when a programmer attempts to run this code?()
-
public class ExceptionTest { class TestException extends Exception {} public void runTest () throws TestException {} public void test () /* Point X*/ { runTest (); } } At point X on line 4, which code can be added to make the code compile?()
-
有如下代码:public class Person { … }下列哪个符合该类的构造方法定义
-
检查下面的代码:class E1 extends Exception{ };class E2 extends E1{ }class SuperQuiz6_2 { }public class Quiz6_3 extends SuperQuiz6_2{public void f(Boolean flag) throws E1{//一一X一一}}下列的语句,哪—个可以放到--X--位置,而且保证编译成功。
-
读代码:public class Test {public static void main (String args[]) {class Foo {public int i = 3;}Object o = (Object) new Foo();Foo foo = (Foo)o;System.out.println(foo.i);}}结果是:
-
检查下面的代码: class E1 extends Exception{ } class E2 extends E1 { } public class Quiz6_5{ public static void main(String[] args){ try{ throw new E1(); } // --X-- } } 下列语句,哪一个可以放到--X--位置,而且保证编译成功。
-
读代码:public class foo {static String s;public static void main (String[]args) {System.out.println (“s=” + s);}}结果是:
-
class Demo{ public static void main(String[] args){ int x = 0; try{ x = div(1,2); }catch(Exception e){ System.out.println(e); } System.out.println(x) ; } public static int div(int a,int b){ return a / b ; } }
-
读代码:public class Test {public static void main (String [] args) {String foo = “blue”;String bar = foo;foo = “green”;System.out.println(bar);}}结果是:
-
(读写文件)下列程序完成了读取指定文件内容的功能,在下划线处应填入的代码是______。import java.io.*; public class test { public static String read (String FileName) throws Exception{ BufferedReader in = new BufferedReader(new FileReader(FileName)); String s = null; StringBuilder sb = new StringBuilder(); While((s=_____.readLine()) != null){ sb.append(s + “n”); } _______.close(); return sb.toString(); } public static void main (String [] args) throws Exception{ System.out.println(read(
-
代码三: public class Test03 { public static void main(); } }
-
以下代码可以编译通过 public class Test01 { public static void main(); } }
-
给定如下代码,下面可以作为该类的构造函数的是()public class Test {}
-
代码四: public class Test04 { public static void main(); n--; } } }
-
某 Java源文件代码如下: public class A { int a; } class B { int b; } class C { public static void main()
-
已知有如下代码: import java.util.*; public class Test{ public static void main(); } }
-
10、以下程序代码运行时输出的结果是()。public class Foo{ public static void main(String[] args){ try{ System.out.print('A'); foo1(); System.out.print('B'); }catch(RuntimeException e){ System.out.print('C'); }catch(Exception e){ System.out.println('D'); } } public static void foo1() throws RuntimeException{ throw new RuntimeException(); } }
-
请阅读下面程序 public class ThreadTest { public static void main(String args) throws Exception{int i=0;Hello t=new Hello();while(true) { System.out.println("Good Moming"+i++); if (i==2 && t.isAlive()) {Syste
推荐题目
- 丁公司根据应收账款信用风险决定,各年坏账计提比例均为年末应收账款余额的8%。该公司计提坏账准备的第一年年末应收账款余额为850000元;第二年客户甲单位所欠20000元按规定确认为坏账,应收账款年末余额为950000元;第三年客户乙单位破产,所欠款项中有6000元无法收回,确认为坏账,年末应收账款余额为900000元;第四年已冲销的甲单位所欠20000元账款又收回15000元,年末应收账款余额为1000000元。则该公司在四年内对应收账款计提坏账准备累计应计入资产减值损失的金额为()元。
- 在遇有接触网断线事故时,必须采取防护措施,使任何人在装设接地线以前不得进入距断线落下地点()米范围以内。
- 管道的底部和弯曲处是管道系统的薄弱环节,这些地方易发生()。
- 根据《医疗饥构药品集中采购工作规范》的规定,对纳入集中采购目录的药品,采取()等方式进行采购。
- 井口趴梁
- 网箱可高密度放养养殖鱼类的原因不包括()
- 蓄电池点火系的每一点火过程可以划分为三个阶段()
- 成功购买好宝贝以后,应该到哪里去看卖家的具体联系方式()
- 【单选题】()是通过启用设施或设备来直接检验被查验对象的安装质量和使用功能,以直观地了解其符合性、舒适性、安全性等 答案:使用查验
- 21、下列叙述不正确的是