Since the method foo() does not catch the exception generated by the method baz(), it must declare the RuntimeException in its throws clause.
A try block cannot be followed by both a catch and a finally block.
An empty catch block is not allowed.
A catch block cannot follow a finally block.
A finally block must always follow one or more catch blocks.
第1题:
下面程序输出的结果是什么? ( ) public class Quiz2 { public static void main(String args[]) { try {throw new MyException(); }catch(Exception e) { System.out.println("It's caught!"); }finally{ System.out.println("It's finally caught!"); } } } class MyException extends Exception{}
A.It's finally caught!
B.It's caught!
C.It's caught!/It's finally caught!
D.无输出
第2题:
What will the following C code do?
int *ptr;
ptr =(int *)Ox67a9;
*ptr = Oxaa55;
第3题:
What happens when you try to compile and run the following program?
class Mystery{String s;public static void main(String[] args){
Mystery m=new Mystery();m.go();}void Mystery(){s=”constructor”;}void go(){System.out.println(s);}
}()
A.this code will not compile
B.this code compliles but throws an exception at runtime
C.this code runs and “constructor” in the standard output
D.this code runs and writes “null” in the standard output
第4题:
Which statements concerning the following code are true?() class a { public a() {} public a(int i) { this(); } } class b extends a { public boolean b(String msg) { return false; } } class c extends b { private c() { super(); } public c(String msg) { this(); } public c(int i) {} }
第5题:
public class foo { public static void main (Stringargs) { String s; system.out.printIn (“s=” + s); } } What is the result?()
第6题:
What will be the output of the following C code?
main()
{
int k, num= 30;
k =(num > 5 ? (num <=10 ? 100:200): 500);
printf("%d", k);
}
第7题:
class One { public One() { System.out.print(1); } } class Two extends One { public Two() { System.out.print(2); } } class Three extends Two { public Three() { System.out.print(3); } } public class Numbers{ public static void main( String[] argv) { new Three(); } } What is the result when this code is executed?()
第8题:
You are developing a Windows Communication Foundation (WCF) service that is hosted by a Windows Forms Application.The ServiceHost instance is created in the Form Constructor.You need to ensure that the service is not blocked while the UI thread is busy.What should you do?()
A. Decorate the service implementation class with the following line of code [ServiceBehavior(UseSyncronizationContext = false)]
B. Decorate the service implementation class with the following line of code [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple)]
C. Call the Invoke method of the form and supply a delegate.
D. Call the BeginInvoke method of the form and supply a delegate.
第9题:
public class Foo { public void main( String[] args ) { System.out.println( “Hello” + args[0] ); } } What is the result if this code is executed with the command line?()
第10题:
During system boot, rootvg fails to vary on, causing an LED code of 0552. What is the most likely cause for rootvg not varying on?()