static void test() throws Error {  if (true) throw new AssertionError();  System.out.print(”test “);  }  public static void main(String[] args) {  try { test(); }  catch (Exception ex) { System.out.print(”exception “); }  System.out.print(”elld “);  }  What is the result?() A、 endB、 Compilation fails.C、 exception endD、 exception test endE、 A Throwable is thrown by main.F、 An Exception is thrown by main.

static void test() throws Error {  if (true) throw new AssertionError();  System.out.print(”test “);  }  public static void main(String[] args) {  try { test(); }  catch (Exception ex) { System.out.print(”exception “); }  System.out.print(”elld “);  }  What is the result?() 

  • A、 end
  • B、 Compilation fails.
  • C、 exception end
  • D、 exception test end
  • E、 A Throwable is thrown by main.
  • F、 An Exception is thrown by main.

相关考题:

有如下类定义:class Test{public:Test(){ a = 0; c = 0;} // ①int f(int a)const{this-a = a;} // ②static int g(){return a;} // ③void h(intB . {Test::b = b;}; // ④private:int a;static int b;const int c;};int Test::b = 0;在标注号码的行中,能被正确编译的是A . ①B . ②C . ③D . ④

下列程序段的输出结果是【 】。public class Test {void printValue(int m) {do {System.out.println("The value is"+m);}while (--m>10);}public static void main (String args[]) {int i=10;Test t= new Test();t.printValue(i);}}

2下列程序实现对ZIP 文件file.zip 的检索,在横线处填入正确的语句是( )。package test;import java.io.*;import java.util.*; import java.util.zip.*;public class Exam{ public static void main(String[] args){ try{ FileInputStream fis = new FilelnputStream("test/file.zip"); ZipInputStream zis = new ZiplnputStream(fis); ZipEntry en; while ((______ )!= null){ en.getName(); zis.closeEntry(); } zis.close(); } catch(Exception e){ e.pfintStackTrace(); }}A.en = zis. getNextEntry()B.en == zis.getNextEntry(C.en=zis. getEntry()D.zis.getNextEntry()

请在下划线处填入代码,是程序正常运行并且输出 “ Hello! ”Class Test 【 15 】 {Public static void main (String[] arge){Test t = new Test();t.start();}Public void run(){System.out.println( “ Hello! ” );}

根据输出结果填空完成下面程序。 include class Test { private: static int val; in 根据输出结果填空完成下面程序。include<iostream.h>class Test{private:static int val;int a;public:static int func( );void sfunc(Test r);};______//初始化静态变量valint Test::func( ){return val++;}void Test::sfunc(Test r){r.a=125;cout<<"Result3="<<r.a;}void main( ){cout<<"Resultl="<<Test::func( )<<endl;Test A;cout<<"Result2="<<A.fune( )<<endl;A. sfunc(A);}输出结果为:Result1=201Result2=202Result3=125

已知如下类说明: 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(); // 程序代码… } } 如下哪个使用是正确的?() A.t.fB.this.nC.Test.mD.Test.n

已知有下列类的说明,则下列哪个语句是正确的?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(); }}A.t.f;B.this. nC.Test.m;D.Test.f;

已知有下列类的说明,则下列( )语句是正确的。 publicClass Test{ private float f=1.0f; int m=12; static int n=1: public static void main(Stringarg[]){ Test t=new Test(): } }A.t.f;B.this.n;C.Test.m;D.Test.f;

已知有下面的类说明: public class Test4 { private float f=1.0f; int m=12; static int n=1; public static void main(String args[]) { Test4 e=new Test4(); } } 在main()方法中,下面哪个的使用是正确的? ( )A.e.fB.this.nC.Test4.mD.Test4.f

使下列程序正常运行并且输出“Hello!”,横线处应填写的内容是( )。 class Test { public static void main(string[]args){ Test t=new Test; start; } Public void run{ System.out.println("Hello!¨); )A.extends ThreadB.extends FloatC.extends IostreamD.extends Stdio

下列程序实现对ZIP文件file.zip的检索,在横线处 填入正确的语句( )。 package test; importjava.io.*; import java.util.*; import java.util.zip.*; public class Exam { public static void main(String[]args){ try{ FileInputStream fis=new FileInputStream("test/file. zip"); ZipInputStream zis=new ZiplnputStream(fis); ZipEntry an; while(( )!=null){ en.getName; zis.closeEntry; } zis.close: } catch(Exception e){ printStackTrace; } } }A.en=zis.getNextEntryB.en= =zis.getNextEntryC.en=zis.getEntryD.zis.getNextEntry

下列代码的执行结果是( )。public class Test{public int aMethod( ){static int i=0;i++;System.out.println(i):}public static void main (String args[]){Trest test=new Test ( );test aMethod( ):}}A.编译错误B.0C.1D.运行成功,但不输出B.C.D.

下列程序的输出结果是 class Demo { void test( ) { Systeme.out.pnnt("NO");} void test(int i) { System.out.print(a);} void test(int a,int b) { System.out.print(a+b);} } class Test { public static void main(String args[ ] ) { Demo de=new Demo( ); de.test( ); de.test(5); de.test(6,8); } }A.No 5 6 8B.5 6 8 NoC.No 5 14D.8 6 No 5

下列程序实现对ZIP文件file.zip的检索,在横线处填入正确的语句 package test; import java.io.*: import java.util.*; import java.util.zip.*; public class Exam { public static void main(String[])args){ try{ FileInputStream fis=new FileInputStream("test/file.zip"); ZipInputStreamzis=new ZipInputStream(fis); ZipEntry en; while ((_____)!=null){ en.getName(); zis.closeEntry(); } zis.close(); } catch(Exception e) { e.printStackTrace(); } } }A.en = zis.getNextEntry()B.en = zis.getNextEntry()C.en = zis.getEntry()D.zis.getNextEntry()

下列程序的输出结果是 ( ) class Derao { void test() { Systeme.out.print("NO");} void test (int i) {System.out.print(a);} void test(int a,int b) {System.out.print(a+b);} } class Test { public static void main(String args[]) { Demo de=new Demo(); de.test(); de.test5.; de.test(6,8); } }A.No568B.568NoC.No514D.86No5

以下代码的输出结果?public class Test{int x=5;public static void main(String argv[]){Test t=new Test();t.x++;change(t);System.out.println(t.x);}static void change(Test m){m.x+=2;}} A. 7B. 6C. 5D. 8

static void test() throws RuntimeException {  try {  System.out.print(”test “);  throw new RuntimeException();  }  catch (Exception ex) { System.out.print(”exception “); }  }  public static void main(String[] args) {  try { test(); }  catch (RuntimeException ex) { System.out.print(”runtime “); }  System.out.print(”end “);  }  What is the result?() A、 test endB、 Compilation fails.C、 test runtime endD、 test exception endE、 A Throwable is thrown by main at runtime.

Public class test (  Public static void main (String args[])  (  System.out.printIn (6 ^ 3);  )  )   What is the output?()

Public class test (  Public static void stringReplace (String text)  (  Text = text.replace (‘j’ , ‘i’);  )  public static void bufferReplace (StringBuffer text)  (  text = text.append (“C”)  )   public static void main (String args[]}  (  String textString = new String (“java”);  StringBuffer text BufferString = new StringBuffer (“java”);  stringReplace (textString);  BufferReplace (textBuffer);  System.out.printLn (textString + textBuffer);  )  )   What is the output?()

static void test() {  try {  String x=null;  System.out.print(x.toString() +“ “);  }  finally { System.out.print(“finally “); }  }  public static void main(String[] args) {  try { test(); }  catch (Exception ex) { System.out.print(”exception “); }  }  What is the result?() A、 nullB、 finallyC、 null finallyD、 Compilation fails.E、 finally exception

public class Test {  public int aMethod() {  static int i = 0;  i++;  return i;  }  public static void main (String args[]) {  Test test = new Test();  test.aMethod();  int j = test.aMethod();  System.out.println(j);  }  }  What is the result?()  A、 0B、 1C、 2D、 Compilation fails.

单选题static void test() throws RuntimeException {  try {  System.out.print(”test “);  throw new RuntimeException();  }  catch (Exception ex) { System.out.print(”exception “); }  }  public static void main(String[] args) {  try { test(); }  catch (RuntimeException ex) { System.out.print(”runtime “); }  System.out.print(”end “);  }  What is the result?()A test endB Compilation fails.C test runtime endD test exception endE A Throwable is thrown by main at runtime.

单选题public class Test {  public int aMethod() {  static int i = 0;  i++;  return i;  }  public static void main (String args[]) {  Test test = new Test();  test.aMethod();  int j = test.aMethod();  System.out.println(j);  }  }  What is the result?()A 0B 1C 2D Compilation fails.

填空题Public class test (    Public static void main (String args) (   System.out.printIn (6^3);   )   )   What is the output? ()

填空题Public class test (    Public static void stringReplace (String text) (    Text = text.replace („j„ , „i„);    )      public static void bufferReplace (StringBuffer text) (    text = text.append (“C”)   )      public static void main (String args ){  String textString = new String (“java”);    StringBuffer text BufferString = new StringBuffer (“java”);      stringReplace (textString);    BufferReplace (textBuffer);      System.out.printIn (textString + textBuffer);    }   )   What is the output?()

单选题static void test() throws Error {  if (true) throw new AssertionError();  System.out.print(”test “);  }  public static void main(String[] args) {  try { test(); }  catch (Exception ex) { System.out.print(”exception “); }  System.out.print(”elld “);  }  What is the result?()A endB Compilation fails.C exception endD exception test endE A Throwable is thrown by main.F An Exception is thrown by main.

单选题public class test(    public int aMethod()[   static int i=0;   i++;   return I;   )    public static void main (String args){   test test = new test();    test.aMethod();   int j = test.aMethod();   System.out.printIn(j);   ]  }   What is the result?()A Compilation will fail.B Compilation will succeed and the program will print “0”C Compilation will succeed and the program will print “1”D Compilation will succeed and the program will print “2”

单选题static void test() {  try {  String x=null;  System.out.print(x.toString() +“ “);  }  finally { System.out.print(“finally “); }  }  public static void main(String[] args) {  try { test(); }  catch (Exception ex) { System.out.print(”exception “); }  }  What is the result?()A nullB finallyC null finallyD Compilation fails.E finally exception