读代码: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
推荐题目
- 变压器套管安装时其顶部结构的密封垫应安装正确,()应良好。
- 《特种设备安全监察条例》自2003年()起施行。
- 单出杆活塞缸活塞杆面积越大,活塞往复运动的速度差别就越大。
- 组成电子喉镜的成像装置的是()
- 砌砖施工的工序?
- 根据我国目前的实际情况,国家审计的首要目标是()
- 进货验收冲销功能描述本模块用于加油站冲销录入错误的内部配送()、()进货单据和库发配送(非加油机销售)进货单据。进货冲销操作不需要单独班次执行,正常业务班次即可录入,但仅能冲销当前业务日期以前的进货单据。进货冲销操作会自动生成红字负数冲销单据,要撤销冲销操作,进入进货录入页面,删除生成的冲销单据即可。
- 发电厂的装机容量应等于()之和:
- 旅客在列车上要求变更铺位、座席时,补收变更区间的票价差额核收手续费()
- 葡萄胎病情观察有哪些()