SCJP在线测试
时间还剩:
联系我们   收藏本站   设为首页   
 
JAVA下载 JAVA文摘 J2me学习 JAVA实例              


SCJP在线测试

〖 姓名:Guest〗

第1题(id号=297):

Which methods are required to implement the interface Runnable?
A. wait()
B. run()
C. stop()
D. update()
E. resume()


请选择: A B C D E

第2题(id号=6):

True or False: Readers have methods that can read and return floats and doubles.

  A. Ture 
  B. False 


请选择: A B

第3题(id号=229):

What is the target in an Event?
A. The Object() where the event came from.
B. The Object() where the event is destined for.
C. What the Object() that generated the event was doing.


请选择: A B C

第4题(id号=645):

Given:

class Bird {
  { System.out.print("bl "); }
  public Bird() { System.out.print("b2 "); }
}

class Raptor extends Bird {
  static { System.out.print("r1 "); }

  public Raptor() { System.out.print("r2 "); }
  { System.out.print("r3 "); }
  static { System.out.print("r4 "); }
}

class Hawk extends Raptor {
  public static void main(String[] args) {
    System.out.print("pre ");
    new Hawk();
    System.out.println("hawk ");
  }
}

 What is the result?

A. pre b1 b2 r3 r2 hawk 

B. pre b2 b1 r2 r3 hawk 

C. pre b2 b1 r2 r3 hawk r1 r4 

D. r1 r4 pre b1 b2 r3 r2 hawk 

E. r1 r4 pre b2 b1 r2 r3 hawk 

F. Compilation fails.


请选择: A B C D E F

第5题(id号=491):

What will be written to the standard output when the following program is run? 
public class Q63e3 { 
  public static void main(String args[]) { 
   System.out.println(9 ^ 2); 
  } 


A) 81 
B) 7 
C) 11 
D) 0 
E) false 


请选择: A B C D E

第6题(id号=626):

 Given:

1. class Zippy {
2.   String[] x;
3.   int[] a [] = {{1,2}, {l}};
4.   Object c = new long [4] ;
5.   Object[] d = x;
6. }

What is the result?

A. Compilation succeeds.

B. Compilation fails due only to an error on line 3.

C. Compilation fails due only to an error on line 4.

D. Compilation fails due only to an error on line 5.

E. Compilation fails due to errors on lines 3 and 5.

F. Compilation fails due to errors on lines 3, 4, and 5.


请选择: A B C D E F

第7题(id号=447):

Consider the following
1. class A extends Integer {
2. int x = 0;
3. }
a. The code will compile correctly.
b. The code will not compile because Integer class is final.
c. The code will not compile because A class doesn't have a constructor.
d. The code will compile but an ArithmeticException at runtime.


请选择: A B C D

第8题(id号=258):

Which of the following are correct methods for initializing the
array "dayhigh" with 7 values?
A. int dayhigh = { 24, 23, 24, 25, 25, 23, 21 };
B. int dayhigh[] = { 24, 23, 24, 25, 25, 23, 21 };
C. int[] dayhigh = { 24, 23, 24, 25, 25, 23, 21 };
D. int dayhigh [] = new int [24, 23, 24, 25, 25, 23, 21];
E. int dayhigh = new [24, 23, 24, 25, 25, 23, 21] ;


请选择: A B C D E

第9题(id号=290):

What will happen when you attempt to compile and run the following code?

public class Test{
   public static void main(String argv[]){
     Test h=new Test();
  }

   protected Test(){
      for(int i=0;i<10;i++){
       System.out.println(i);
      }
   }
 }

Select the one right answer
A. Compilation error:Constructors cannot be declared protected
B. Run time error:Constructors cannot be declared protected
C. Compilation and running with output o to 10
D. Compilation and running with output 0 to 9


请选择: A B C D

第10题(id号=460):

What will be the result of attempting to compile and run the following class?
1. public class Integers {
2. public static void main(String args[]){
3. System.out.printl(0x10 + 10 + 010);
4. }
5. }
Select the one right answer.
a. The code won't compile. The compiler will complain 
   about the expression 0x10 + 10 + 010
b. When run, the program will print "28"
c. When run, the program will print "34"
d. When run, the program will print "36"


请选择: A B C D

第11题(id号=479):

A method is ... 

A) an implementation of an abstraction. 
B) an attribute defining the property of a particular abstraction. 
C) a category of objects. 
D) an operation defining the behavior for a particular abstraction. 
E) a blueprint for making operations. 


请选择: A B C D

第12题(id号=557):

Which layout manager is used when the frame is resized the buttons's
 position in the Frame might be changed? 
  A. BorderLayout
  B. FlowLayout
  C. CardLayout
  D. GridLayout 


请选择: A B C D

第13题(id号=270):


Consider the following code:
What will be printed?
public class AB{
  public static void main (String[] args){
   int x = 1;
   if (0 < --x){
    System.out.println(x);
   }
 }
}
A. 0
B. 1
C. 2
D. Nothing
E. An IllegalArgumentException will be thrown


请选择: A B C D E

第14题(id号=486):

Given the following class, which statements can be inserted at 
position 1 without causing the code to fail compilation? 

public class Q6db8 { 
 int a; 
 int b = 0; 
 static int c; 
 public void m() { 
  int d; 
  int e = 0; 
  // Position 1 
 } 


A) a++; 
B) b++; 
C) c++; 
D) d++; 
E) e++; 


请选择: A B C D E

第15题(id号=133):

 class EnclosingOne{ 
  public class InsideOne{} 
    } 

  public class InnerTest{ 
   public static void main(String args[]){ 
    EnclosingOne eo=new EnclosingOne(); 
    //insert code here 
   } 
  } 
  A.InsideOne ei=eo.new InsideOne(); 
  B.eo.InsideOne ei=eo.new InsideOne(); 
  C.InsideOne ei=EnclosingOne.new InsideOne(); 
  D.InsideOne ei=eo.new InsideOne(); 
  E.EnclosingOne.InsideOne ei=eo.new InsideOne(); 


请选择: A B C D E

第16题(id号=409):

What is the output of the following program?
 public class Q11 {
   static String str1 = "main method with String[] args";
   static String str2 = "main method with int[] args";
   public static void main(String[] args){
     System.out.println(str1);
   }

   public static void main(int[] args){
     System.out.println(str2);
   }
 }
a. Duplicate method main(), compilation error at line 5.
b. Duplicate method main(), compilation error at line 10.
c. Prints "main method with String[] args".
d. Prints "main method with int[] args". 


请选择: A B C D

第17题(id号=687):

Given:

interface Hungry<E> { void munch(E x); }
interface Carnivore<E extends Animal> extends Hungry<E> {}
interface Herbivore<E extends Plant> extends Hungry<E> {}
abstract class Plant {}
class Grass extends Plant {}
abstract class Animal {}
class Sheep extends Animal implements Herbivore<Sheep> {
  public void munch(Sheep x) {}
}
class Wolf extends Animal implements Carnivore<Sheep> {
  public void munch(Sheep x) {}
}


Which of the following changes (taken separately) would allow this code to compile? 
(Choose all that apply.)

A. Change the Carnivore interface to

   interface Carnivore<E extends Plant> extends Hungry<E> {}

B. Change the Herbivore interface to

  interface Herbivore<E extends Animal> extends Hungry<E> {}

C. Change the Sheep class to

  class Sheep extends Animal implements Herbivore<Plant> {
    public void munch(Grass x) {}
  }

D. Change the Sheep class to

   class Sheep extends Plant implements Carnivore<Wolf> {
    public void munch(Wolf x) {}
   }

E. Change the Wolf class to

   class Wolf extends Animal implements Herbivore<Grass> {
    public void munch(Grass x) {}
   }

F. No changes arc necessary.


请选择: A B C D E F

第18题(id号=379):

Consider the following code: What will be printed?
public class ArrayTest3{
  public static void main(String[]args){
    int [][] a = new int[5][5];
    System.out.println(a[4][4]);
  }
}
A. 0 0 0 0
B. 0 0
C. 0
D. 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0


请选择: A B C D

第19题(id号=284):

Consider the code below:
arr[0] = new int[4];
arr[1] = new int[3];
arr[2] = new int[2];
arr[3] = new int[l];
for(int n = 0; n < 4; n++)
   System.out.println ( /*What will work here? */);
Which statement below, when inserted as the body of the for loop, would
print the number of values in each row?
A. arr[n].length();
B. arr.size;
C. arr.size -1;
D. arr[n] [size] ;
E. arr[n].length;


请选择: A B C D E

第20题(id号=110):

8.
 int i=1,j=10; 
 do{ 
   if(i++>--j) continue; 
 }while(i<5); 
After Execution, what are the value for i and j? 
A. i=6 j=5 
B. B.i=5 j=5 
C. i=6 j=4 
D. i=5 j=6 
E. i=6 j=6 


请选择: A B C D E

第21题(id号=180):

 which constructs a DataOutputStream ? 
  A.new DataOutputStream("out.txt"); 
  B.new DataOutputStream(new File("out.txt")); 
  C.new DataOutputStream(new Writer("out.txt")); 
  D.new DataOutputStream(new OutputStream("out.txt")); 
  E.new DataOutputStream(new FileWriter("out.txt")); 
  F.new DataOutputStream(new FileOutputSream("out.txt")); 


请选择: A B C D E F

第22题(id号=678):

Given:

import java.util.*;
class Test {
  public static void main(String[] args) {
    // insert code here
    x.add("one");
    x.add("two");
    x.add ("TWO");
    System.out.printIn(x.poll());
  }
}

Which, inserted at // insert code here, will compile? (Choose all that apply.)

A. List<String> x = new LinkedList<String>(); 

B. TreeSet<String> x = new TreeSet<String>(); 

C. HashSet<String> x = new HashSet<String>(); 

D. Queue<String> x = new PriorityQueue<String>(); 

E. ArrayList<String> x = new ArrayList<String>(); 

F. LinkedList<String> x = new LinkedList<String>(); 


请选择: A B C D E F

第23题(id号=164):

 The file "file.txt" exists on the file system and contains ASCII text. 
   try{ 
     File f=new File("file.txt"); 
     OutputStream out=new FileOutputStream(f); 
     }catch (IOException e){} 
   A. the code does not compile 
   B. the code runs and no change is made to the file 
   C. the code runs and sets the length of the file to 0 
   D. An exception is thrown because the file is not closed 
   E. the code runs and deletes the file from the file system 


请选择: A B C D E

第24题(id号=686):

Given a properly prepared String array containing five elements, 
which range of results could a proper invocation of Arrays.binarysearch() produce?

A. 0 through 4

B. 0 through 5

C. - 1 through 4

D. -1 through 5

E. - 5 through 4

F. -5 through 5

G. -6 through 4


请选择: A B C D E F G

第25题(id号=181):

 which statement is true for the class java.util.HashSet? 
  A.The elements in the collection are ordered 
  B.The collection is guaranteeded to be immutable 
  C.The elements in the collection are guaranteeded to be unique 
  D.The elements in the collection are access using a unique key 
  E.The elements in the collection are guaranteed to be synchronized 


请选择: A B C D E

第26题(id号=230):

What is the statement to assign a unicode constant CODE with 0x30a0?
A. public static final char CODE='u30a0'
B. public final char CODE='u30a0'


请选择: A B

第27题(id号=400):

Which statement about static inner classes is true? 
A.An anonymous class can be declared as static 
B.A static inner class cannot be a static member of the outer class 
C.A static inner class does not require an instance of the enclosing class 
D.Instance members of a static inner class can be referenced using the class name of 
  the static inner class 


请选择: A B C D

第28题(id号=1):

Which of the following are Java keywords?
A. goto
B. malloc
C. extends
D. FALSE Select all correct answers


请选择: A B C D

第29题(id号=9):

Which statement or statements are true about the code listed below? Choose three. 

  1. public class MyTextArea extends TextArea { 
  2. public MyTextArea(int nrows, int ncols) { 
  3. enableEvents(AWTEvent.TEXT_ EVENT_MASK); 
  4. } 
  5. 
  6. public void processTextEvent (TextEvent te) { 
  7. System.out.println(“Processing a text event.”); 
  8. } 
  9. } 

  A. The source code must appear in a file called MyTextArea.java 
  B. Between lines 2 and 3, a call should be made to super(nrows, ncols) so that the 
       new component will have the correct size. 
  C. At line 6, the return type of processTextEvent() should be declared boolean, not 
       void. 
  D. Between lines 7 and 8, the following code should appear: return true. 
  E. Between lines 7 and 8, the following code should appear: super.processTextEvent(te). 


请选择: A B C D E

第30题(id号=369):

public class ExceptionTest{
  public static void main(String [] args){
    ExceptionTest e = new ExceptionTest();
    e.trythis();
  }

  public void trythis(){
    try{
      System.out.println("1");
      problem();
    }catch (RuntimeException x){
      System.out.println("2");
      return;
    }catch(Exception x){
      System.out.println("3");
      return;
   }finally{
      System.out.println("4");
   }
      System.out.println("5");
   }

 public void problem() throws Exception{
     throw new Exception();
 }
}
A. 1
B. 2
C. 3
D. 4
E. 5


请选择: A B C D E

第31题(id号=643):

Given:

1. class Eco {
2.   public static void main(String[] args)    {
3.     Eco e1 = new Eco();
4.     Eco e2 = new Eco();
5.     Eco e3 = new Eco();
6.     e3.e = e2;
7.     e1.e = e3;
8.     e2 = null;
9.     e3 = null;
10.    e2.e = el;
11.    e1   =  null;
12.  }
13.  Eco e;
14. }

At what point is only a single object eligible for GC?

A. After line 8 runs.

B. After line 9 runs.

C. After line 10 runs.

D. After line 11 runs.

E. Compilation fails.

F. Never in this program.

G. An exception is thrown at runtime.


请选择: A B C D E F G

第32题(id号=206):

Given: 
1. class Super { 
2. public float getNum() {return 3.0f;} 
3. } 
4.   
5. public class Sub extends Super { 
6.   
7. } 
Which method, placed at line 6, will cause a compiler error? 
A. public float getNum()   {return 4.0f; } 
B. public void getNum ()  { } 
C. public void getNum (double d)   { } 
D. public double getNum (float d) {retrun 4.0f; } 


请选择: A B C D

第33题(id号=378):

Consider the following code: What will be printed?
class Arraytest2{
 public static void main(String[]args){
  int [] arr = {1, 2, 3};
  for(int i = 0; i < 2; i++){
    arr[i] = 0;
  }
  for(int i = 0; i < 3; i++){
    System.out.println(arr [i]);
  }
}
}
A. 1 2 3
B. 0 0 3
C. 0 2 3
D. 0 0 0


请选择: A B C D

第34题(id号=225):

What would you use when you have duplicated values that needs to be sorted?
A. Map
B. Set
C. Collection
D. List
E. Enumeration


请选择: A B C D E

第35题(id号=48):

A public member vairable called MAX_LENGTH which is int type, the value of the variable 
remains constant value 100. Use a short statement to define the variable.
  A. public int MAX_LENGTH=100;
  B. final int MAX_LENGTH=100;
  C. final public int MAX_LENGTH=100;
  D. public final int MAX_LENGTH=100.


请选择: A B C D

第36题(id号=359):

Carefully examine the following code:
public class StaticTest {
 static {
  System.out.println("Hi there");
 }
 public void print() {
  System.out.println("Hello");
 }
public static void main(String args []) {
  StaticTest st1 = new StaticTest();
  st1.print();
  StaticTest st2 = new StaticTest();
  st2.print();
} }
When will the string "Hi there" be printed?
A. Never.
B. Each time a new instance is created.
C. Once when the class is first loaded into the Java virtual machine.
D. Only when the static method is called explicitly.
Select the most appropriate answer.


请选择: A B C D

第37题(id号=633):

Given:

class Clidder {
  private final void flipper() { System.out.println ("Clidder"); }
}

public class Clidlet extends Clidder {
  public final void flipper() { System.out.println("Clidlet");  }
  public static void main(String [] args) {
    new Clidlet().flipper();
  }
}

What is the result?

A. Clidlet 

B. Clidder 

C. Clidder 

   Clidlet 

D. Clidlet 

   Clidder 

E. Compilation fails.


请选择: A B C D E

第38题(id号=714):

Given the following

 1.  public class WaitTest {
 2.     public static void main(String [] args) {
 3.        System.out.print("1 ") ;
 4.        synchronized(args) {
 5.           System.out.print("2 " ) ;
 6.           try {
 7.              args.wait();
 8.           }
 9.           catch(InterruptedException e){}
10.        }
11.        System.out.print("3 ");
12.     }
13.  }

What is the result of trying to compile and run this program?

A. It fails to compile because the IllegalMonitorStateException of wait() 
   is not dealt with in line 7.

B. 1 2 3 

C. 1 3 

D. 1 2 

F. At runtime, it throws an IllegalMonitorStateException when trying to wait.

G. It will fail to compile because it has to be synchronized on the this object.


请选择: A B C D E F G

第39题(id号=451):

What does the following program do when it is run 
with the following command?java Mystery Mighty Mouse
1. class Mystery {
2. public static void main(String args[]){
3. Changer c = new Changer();
4. c.method(args);
5. System.out.println(args[0] + " " + args[1]);
6. }
7. static class Changer {
8. void method(String s[]) {
9. String temp = s[0];
10. s[0] = s[1];
11. s[1] = temp;
12. }
13. }
14. }
a. The program causes and ArrayIndexOutOfBoundsException to 
   be thrown.
b. The program runs but does not write anything to the 
   standard output.
c. The program writes "Mighty Mouse" to the standard output.
d. The program writes "Mouse Mighty" to the standard output.


请选择: A B C D

第40题(id号=701):

Given:

public class Foo {
   Foo() {System.out.print("foo");}
   class Bar{
      Bar() {System.out.print("bar");}
      public void go() {System.out.print("hi");}
   }
   public static void main(String[] args) {
      Foo f = new Foo ();
      f.makeBar();
   }
   void makeBar() {
     (new Bar() {}).go();
   }
}

What is the result?

A. Compilation fails.

B. An error occurs at runtime.

C. foobarhi 

D. barhi 

E. hi 

F. foohi 


请选择: A B C D E F

第41题(id号=565):

1. public class TeSet {
2. public static void main(String args[]) {
3. int m = 2;
4. int p = 1;
5. int t = 0;
6. for(;p < 5;p++) {
7. if(t++ > m) {
8. m = p + t;
9. }
10. }
11. System.out.println("t equals " + t);
12. }
13. }
What is the resulting value of t?
A 2
B 4
C 6
D 7


请选择: A B C D

第42题(id号=582):

which three are valid declaraction of a float? 
 A. float foo=-1; 
 B. float foo=1.0; 
 C. float foo=42e1; 
 D. float foo=2.02f; 
 E. float foo=3.03d; 
 F. float foo=0x0123; 


请选择: A B C D E F

第43题(id号=23):

Which keyword should be used to enable interaction with the lock of an 
object? The flag allows exclusive access to that object. 
A. transient
B. synchronized
C. serialize
D. static 


请选择: A B C D

第44题(id号=119):

Given the following class outline: 
   class Example{ 
   private int x; 
   // rest of class body 
   public static void main(String args[]){ 
   //implementation of main mehtod} 
   } 
   Which statement is true? 
   A. x=2 is a valid assignment in the main() method of class Example. 
   B. Changing private int x to int x would make x=2 a valid assignment in the main() 
        method of class Example. 
   C. Changing private int x to public int x would make x=2 a valid assignment in
        the main() method of class Example. 
   D. Changing private int x to static int x would make x=2 a valid assignment 
       the main() method of class Example. 
   E. Changing class Example to public class Example would make x=2 a valid assignment
        in the main() method of class Example. 


请选择: A B C D E

第45题(id号=2):

How can you force garbage collection of an object? 

  A. Garbage collection cannot be forced 
  B. Call System.gc(). 
  C. Call System.gc(), passing in a reference to the object to be garbage collected. 
  D. Call Runtime.gc(). 
  E. Set all references to the object to new values(null, for example). 


请选择: A B C D E

第46题(id号=322):

Given the following code:
public class Test {
   … }
Which of the following can be used to define a constructor for this class:
A. public void Test() {… }
B. public Test() {… }
C. public static Test() {… }
D. public static void Test() {… }
Select the most appropriate answer.


请选择: A B C D

第47题(id号=304):

Of the five Component methods listed below, only one is also a
method of the class MenuItem. Which one?
A. setVisible (boolean b)
B. setEnabled (boolean b)
C. getSize ()
D. setForeground (Color c)
E. setBackground (Color c)


请选择: A B C D E

第48题(id号=152):

 class A implements Runnable{ 
   public int i=1; 
   public void run(){ 
    this.i=10; 
    } 
    } 
   public class Test{ 
    public static void main(String args){ 
     A a=new A(); 
   11)  new Thread(a).start(); 
        int j=a.i; 
   13) 
    } 
    } 
   what is the value of j at line 13? 
    A. 1 
    B. 10 
    C. the value of j cannot be determined 
    D. An error at line 11 cause compilation to fail 


请选择: A B C D

第49题(id号=203):

 Given: 
8.  int index = 1; 
9.  boolean[] test = new Boolean[3]; 
10. boolean foo= test [index]; 
What is the result? 
A. foo has the value of 0 
B. foo has the value of null 
C. foo has the value of true 
D. foo has the value of false 
E. an exception is thrown 
F. the code will not compile 


请选择: A B C D E F

第50题(id号=67):

What will be the output on compiling/running the following code?

public class MyThread implements Runnable 

    String myString = "Yes "; 
    public void run() 
    { 
        this.myString = "No "; 
    } 
    public static void main(String[] args) 
    { 
        MyThread t = new MyThread(); 
        new Thread(t).start(); 
        for (int i=0; i < 10; i++) 
        System.out.print(t.myString); 
    } 
}

A. Compilation Error
B. Prints : Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes and so on.
C. Prints : No No No No No No No No No No and so on.
D. Prints : Yes No Yes No Yes No Yes No Yes No and so on.
E. The Output cannot be determined.


请选择: A B C D E

第51题(id号=238):

What should you use to position a Button within an application
frame so that the height of the Button is affected by the Frame size
but the width is not affected.
A. FlowLayout
B. GridLayout
C. Center area of a BorderLayout
D. East or West of a BorderLayout
E. North or South of a BorderLayout


请选择: A B C D E

第52题(id号=368):

If raf is a RandomAccessFile, what is the result of compiling and executing the 
 following code? 
raf.seek(raf.length());
A. The code will not compile.
B. An IOException will be thrown.
C. The file pointer will be positioned immediately before the last character of the file.
D. The file pointer will be positioned immediately after the last character of the file.


请选择: A B C D

第53题(id号=440):

Given this code snippet,
 try {
   tryThis();
   return;
 } catch(IOException x1) {
   System.out.println("exception 1");
   return;
 } catch(Exception x2) {
     System.out.println("exception 2");
     return;
 } finally {
     System.out.println("finally");
 }
what will appear in the standard output if tryThis() throws a IOException?
a. "exception 1" followed by "finally"
b. "exception 2" followed by "finally"
c. "exception 1"
d. "exception 2"


请选择: A B C D

第54题(id号=47):

public class Parent {
  public int addValue( int a, int b) {
  int s;
  s = a+b;
  return s;
  }
  }
  class Child extends Parent {
  }
  Which methods can be added into class Child?
  A. int addValue( int a, int b ){// do something...}
  B. public void addValue (){// do something...}
  C. public int addValue( int a ){// do something...}
  D. public int addValue( int a, int b )throws MyException {//do something...}


请选择: A B C D

第55题(id号=615):

Which method names follow the JavaBeans standard? (Choose all that apply.)

A. addSize 

B. getCust 

C. deleteRep 

D. isColorado 

F. putDimensions 


请选择: A B C D E

第56题(id号=348):

What is the effect of adding the sixth element to a vector created in the following
manner:
new Vector(5, 10);
A. An IndexOutOfBounds exception is raised.
B. The vector grows in size to a capacity of 10 elements
C. The vector grows in size to a capacity of 15 elements
D. Nothing, the vector will have grown when the fifth element was added
Select the most appropriate answer.


请选择: A B C D

第57题(id号=544):

A class design requires that a member variable cannot be accessible directly 
outside the class. Which modifier should be used to obtain the access control?
A. public
B. no modifier
C. protected
D. private


请选择: A B C D

第58题(id号=570):

Which statement about the Map interface is true?
A Entries are placed in a Map using the values() method.
B Entries are placed in a Map using the entrySet() method.
C A key/value association is added to a Map using the put() method.
D A key/value association is added to a Map using the putAll() method.


请选择: A B C D

第59题(id号=660):

Given:

class Plane {
  static String s = "-";
  public static void main(String[] args) {
    new Plane().s1() ;
    System.out.println(s);
  }
  void sl() {
    try { s2();
    catch (Exception e) { s += "c"; }
  }
  void s2() throws Exception  {
    s3();  s += "2";
    s3();  s += "2b";
  }
  void s3() throws Exception {
    throw new Exception();
  }
}

What is the result?

A. -

B. -c 

C. -c2 

D. -2c 

E. -c22b 

F. -2c2b 

G. -2c2bc 


请选择: A B C D E F G

第60题(id号=71):

Give the following method: 
1) public void method( ){ 
2) String a,b; 
3) a=new String(“hello world”); 
4) b=new String(“game over”); 
5) System.out.println(a+b+”ok”); 
6) a=null; 
7) a=b; 
8) System.out.println(a); 
9) } 
In the absence of compiler optimization, which is the earliest point the object 
a refered is definitely elibile to be garbage collection. 

A. before line 3 
B. before line 5 
C. before line 6 
D. before line 7 
E. Before line 9 


请选择: A B C D E


如果你想交卷,请点击提交按钮: