单选题11.rbo = new ReallyBigObject(); 12.//more code here 13.rbo = null; 14./*insert code here*/ Which statement should be placed at line 14 to suggest that the virtual machine expend effort toward recycling the memory used by the objectrbo?()A System.gc();B

题目
单选题
11.rbo = new ReallyBigObject(); 12.//more code here 13.rbo = null; 14./*insert code here*/ Which statement should be placed at line 14 to suggest that the virtual machine expend effort toward recycling the memory used by the objectrbo?()
A

System.gc();

B

Runtime.gc();

C

System.freeMemory();

D

Runtime.getRuntime().growHeap();

E

Runtime.getRuntime().freeMemory();


相似考题
更多“11.rbo = new ReallyBigObject(); 12.//more code here 13.rbo =”相关问题
  • 第1题:

    11. List list = // more code here  12. Collections.sort(list, new MyComparator());  Which code will sort this list in the opposite order of the sort in line 12?() 

    • A、 Collections.reverseSort(list, new MyComparator());
    • B、 Collections.sort(list, new MyComparator()); list.reverse();
    • C、 Collections.sort(list, new InverseComparator( new MyComparator()));
    • D、 Collections.sort(list, Collections.reverseOrder( new MyComparator()));

    正确答案:D

  • 第2题:

    现有:  1.  class Propeller2  {  2.   pulolic static void main (String[]args)//add code here?      3.    {  new Propeller2().topGo();  }      4.  5.void topGo()  //add code here?      6.    {   middleGo();  }      7.  8.void middleGo()  //add code here?  9. {   go();  System.out.println ("late middle");  }    void go()  //add code here?      12.    {throw new Exception();  }      13.  }  为使代码通过编译,需要在哪一行加入声明throws Exception?()     

    • A、只在第11行
    • B、在第8行和第11行
    • C、在第5行、第8行和第11行
    • D、在第2行、第5行、第8行和第11行

    正确答案:D

  • 第3题:

    11. rbo = new ReallyBigObject();  12. // more code here  13. rbo = null;  14. /* insert code here */  Which statement should be placed at line 14 to suggest that the virtual machine expend effort toward recycling the memory used by the object rbo?() 

    • A、 System.gc();
    • B、 Runtime.gc();
    • C、 System.freeMemory();
    • D、 Runtime.getRuntime().growHeap();
    • E、 Runtime.getRuntime().freeMemory();

    正确答案:A

  • 第4题:

    Which three will compile and run without exception?()

    • A、private synchronized Object o;
    • B、void go() {synchronized() { /* code here */ }
    • C、public synchronized void go() { /* code here */ }
    • D、private synchronized(this) void go() { /* code here */ }
    • E、void go() {synchronized(Object.class) { /* code here */ }
    • F、void go() {Object o = new Object();synchronized(o) { /* code here */ }

    正确答案:C,E,F

  • 第5题:

    多选题
    Given:   10. class One {   11. void foo() { }   12. }   13. class Two extends One {   14. //insert method here   15. }   Which three methods, inserted individually at line 14, will correctly complete class Two?()
    A

    public void foo() { /* more code here */ }

    B

    private void foo() { /* more code here */ }

    C

    protected void foo() { /* more code here */ }

    D

    int foo() { /* more code here */ }

    E

    void foo() { /* more code here */ }


    正确答案: A,D
    解析: 暂无解析

  • 第6题:

    多选题
    Given: Which three methods, inserted individually at line 14, will correctly complete class Two?()
    A

    int foo() { /* more code here */ }

    B

    void foo() { /* more code here */ }

    C

    public void foo() { /* more code here */ }

    D

    private void foo() { /* more code here */ }

    E

    protected void foo() { /* more code here */ }


    正确答案: D,B
    解析: 暂无解析

  • 第7题:

    单选题
    10. class Line {  11. public static class Point { }  12. }  13.  14. class Triangle {  15. // insert code here  16. }  Which code, inserted at line 15, creates an instance of the Point class defined in Line?()
    A

     Point p = new Point();

    B

     Line.Point p = new Line.Point();

    C

     The Point class cannot be instatiated at line 15.

    D

     Line 1 = new Line() ; 1.Point p = new 1.Point();


    正确答案: D
    解析: 暂无解析

  • 第8题:

    多选题
    Given 11.public interface Status { 12./* insert code here */ int MY_VALUE = 10; 13.} Which three are valid on line 12?()
    A

    final

    B

    static

    C

    native

    D

    public

    E

    private


    正确答案: B,C
    解析: 暂无解析

  • 第9题:

    多选题
    Which three will compile and run without exception?()
    A

    private synchronized Object o;

    B

    void go(){   synchronized(){/* code here */}

    C

    public synchronized void go(){/* code here */}

    D

    private synchronized(this) void go(){/* code here */}

    E

    void go(){   synchronized(Object.class){/* code here */}

    F

    void go(){   Object o = new Object();   synchronized(o){/* code here */}


    正确答案: A,F
    解析: 暂无解析

  • 第10题:

    多选题
    1. public class A {  2. public void method1() {  3. B b=new B();  4. b.method2();  5. // more code here  6. }  7. }  1. public class B {  2. public void method2() {  3.C c=new C();  4. c.method3();  5. // more code here  6. }  7. }  1. public class C {  2. public void method3() {  3. // more code here  4. }  5. }  Given:  25. try {  26. A a=new A();  27. a.method1();  28. } catch (Exception e) {  29. System.out.print(”an error occurred”);  30. }  Which two are true if a NullPointerException is thrown on line 3 of class C?()
    A

    The application will crash.

    B

    The code on line 29 will be executed.

    C

    The code on line 5 of class A will execute.

    D

    The code on line 5 of class B will execute.

    E

    The exception will be propagated back to line 27.


    正确答案: D,C
    解析: 暂无解析

  • 第11题:

    多选题
    10. class Foo {  11. static void alpha() { /* more code here */ }  12. void beta() { /* more code here */ }  13. }  Which two are true?()
    A

    Foo.beta() is a valid invocation of beta().

    B

    Foo.alpha() is a valid invocation of alpha().

    C

    Method beta() can directly call method alpha().

    D

    Method alpha() can directly call method beta().


    正确答案: B,A
    解析: 暂无解析

  • 第12题:

    单选题
    11. rbo = new ReallyBigObject();  12. // more code here  13. rbo = null;  14. /* insert code here */  Which statement should be placed at line 14 to suggest that the virtual machine expend effort toward recycling the memory used by the object rbo?()
    A

     System.gc();

    B

     Runtime.gc();

    C

     System.freeMemory();

    D

     Runtime.getRuntime().growHeap();

    E

     Runtime.getRuntime().freeMemory();


    正确答案: A
    解析: 暂无解析

  • 第13题:

    10. class Line {  11. public static class Point { }  12. }  13.  14. class Triangle {  15. // insert code here  16. }  Which code, inserted at line 15, creates an instance of the Point class defined in Line?() 

    • A、 Point p = new Point();
    • B、 Line.Point p = new Line.Point();
    • C、 The Point class cannot be instatiated at line 15.
    • D、 Line 1 = new Line() ; 1.Point p = new 1.Point();

    正确答案:B

  • 第14题:

    public class Team extends java.util.LinkedList {  public void addPlayer(Player p) {  add(p);  }  public void compete(Team opponent) { /* more code here */ }  }  class Player { /* more code here */ }  Which two are true?()

    • A、 This code will compile.
    • B、 This code demonstrates proper design of an is-a relationship.
    • C、 This code demonstrates proper design of a has-a relationship.
    • D、 A Java programmer using the Team class could remove Player objects from a Team object.

    正确答案:A,D

  • 第15题:

    10. class Line {  11. public class Point { public int x,y; }  12. public Point getPoint() { return new Point(); }  13. }  14. class Triangle {  15. public Triangle() {  16. // insert code here  17. }  18. }  Which code, inserted at line 16, correctly retrieves a local instance of a Point object?() 

    • A、 Point p = Line.getPoint();
    • B、 Line.Point p = Line.getPoint();
    • C、 Point p = (new Line()).getPoint();
    • D、 Line.Point p = (new Line()).getPoint();

    正确答案:D

  • 第16题:

    Given 11.public interface Status { 12./* insert code here */ int MY_VALUE = 10; 13.} Which three are valid on line 12?()

    • A、final
    • B、static
    • C、native
    • D、public
    • E、private

    正确答案:A,B,D

  • 第17题:

    多选题
    class One {  void foo() {}  }  class Two extends One {   //insert method here  }  Which three methods, inserted individually at line 14, will correctly complete class Two?()
    A

    int foo() { /* more code here */ }

    B

    void foo() { /* more code here */ }

    C

    public void foo() { /* more code here */ }

    D

    private void foo() { /* more code here */ }

    E

    protected void foo() { /* more code here */ }


    正确答案: B,C,E
    解析: 暂无解析

  • 第18题:

    多选题
    public class Team extends java.util.LinkedList {  public void addPlayer(Player p) {  add(p);  }  public void compete(Team opponent) { /* more code here */ }  }  class Player { /* more code here */ }  Which two are true?()
    A

    This code will compile.

    B

    This code demonstrates proper design of an is-a relationship.

    C

    This code demonstrates proper design of a has-a relationship.

    D

    A Java programmer using the Team class could remove Player objects from a Team object.


    正确答案: A,D
    解析: 暂无解析

  • 第19题:

    单选题
    11. List list = // more code here  12. Collections.sort(list, new MyComparator());  Which code will sort this list in the opposite order of the sort in line 12?()
    A

     Collections.reverseSort(list, new MyComparator());

    B

     Collections.sort(list, new MyComparator()); list.reverse();

    C

     Collections.sort(list, new InverseComparator( new MyComparator()));

    D

     Collections.sort(list, Collections.reverseOrder( new MyComparator()));


    正确答案: D
    解析: 暂无解析

  • 第20题:

    单选题
    10. class Line {  11. public class Point { public int x,y; }  12. public Point getPoint() { return new Point(); }  13. }  14. class Triangle {  15. public Triangle() {  16. // insert code here  17. }  18. }  Which code, inserted at line 16, correctly retrieves a local instance of a Point object?()
    A

     Point p = Line.getPoint();

    B

     Line.Point p = Line.getPoint();

    C

     Point p = (new Line()).getPoint();

    D

     Line.Point p = (new Line()).getPoint();


    正确答案: A
    解析: 暂无解析

  • 第21题:

    单选题
    public class Score implements Comparable {  private int wins, losses;  public Score(int w, int 1) { wins = w; losses = 1; }  public int getWins() { return wins; }  public int getLosses() { return losses; }  public String toString() {  return “”; }  // insert code here  }  Which method will complete this class?()
    A

     public int compareTo(Object o) {/*mode code here*/}

    B

     public int compareTo(Score other) {/*more code here*/}

    C

     public int compare(Score s1,Score s2){/*more code here*/}

    D

     public int compare(Object o1,Object o2){/*more code here*/}


    正确答案: B
    解析: 暂无解析

  • 第22题:

    单选题
    现有:  1.  class Propeller2  {  2.   pulolic static void main (String[]args)//add code here?      3.    {  new Propeller2().topGo();  }      4.  5.void topGo()  //add code here?      6.    {   middleGo();  }      7.  8.void middleGo()  //add code here?  9. {   go();  System.out.println ("late middle");  }    void go()  //add code here?      12.    {throw new Exception();  }      13.  }  为使代码通过编译,需要在哪一行加入声明throws Exception?()
    A

    只在第11行

    B

    在第8行和第11行

    C

    在第5行、第8行和第11行

    D

    在第2行、第5行、第8行和第11行


    正确答案: B
    解析: 暂无解析

  • 第23题:

    单选题
    11.rbo = new ReallyBigObject(); 12.//more code here 13.rbo = null; 14./*insert code here*/ Which statement should be placed at line 14 to suggest that the virtual machine expend effort toward recycling the memory used by the objectrbo?()
    A

    System.gc();

    B

    Runtime.gc();

    C

    System.freeMemory();

    D

    Runtime.getRuntime().growHeap();

    E

    Runtime.getRuntime().freeMemory();


    正确答案: B
    解析: 暂无解析

  • 第24题:

    多选题
    11. public interface Status {  12. /* insert code here */ int MY_VALUE = 10;  13. }  Which three are valid on line 12?()
    A

    final

    B

    static

    C

    native

    D

    public

    E

    private

    F

    abstract

    G

    protected


    正确答案: G,A
    解析: 暂无解析