OCJP(310-065)

多选题Given a class whose instances, when found in a collection of objects, are sorted by using the compare To method, which two statements are true?()AThe class implements java.lang.Comparable.BThe class implements java.util.Comparator.CThe interface used t

题目
多选题
Given a class whose instances, when found in a collection of objects, are sorted by using the compare To method, which two statements are true?()
A

The class implements java.lang.Comparable.

B

The class implements java.util.Comparator.

C

The interface used to implement sorting allows this class to define only one sort sequence.

D

The interface used to implement sorting allows this class to define many different sort sequences.

如果没有搜索结果,请直接 联系老师 获取答案。
如果没有搜索结果,请直接 联系老师 获取答案。
相似问题和答案

第1题:

Which statements concerning the methods notify() and notifyAll() are true?  

  • A、Instances of class Thread have a method called notify().
  • B、A call to the method notify() will wake the thread that currently owns the monitor of the object.
  • C、The method notify() is synchronized.
  • D、The method notifyAll() is defined in class Thread.
  • E、When there is more than one thread waiting to obtain the monitor of an object, there is no way to be     sure which thread will be notified by the notify() method.

正确答案:A,E

第2题:

Which two demonstrate an “is a” relationship?()   

  • A、 public interface Person { }  public class Employee extends Person { }
  • B、 public interface Shape { }  public class Employee extends Shape { }
  • C、 public interface Color { }  public class Employee extends Color { }
  • D、 public class Species { }  public class Animal (private Species species;)
  • E、 interface Component { }  Class Container implements Component ( Private Component[ ] children;  )

正确答案:D,E

第3题:

Given a class whose instances, when found in a collection of objects, are sorted by using the compareTo()method, which two statements are true?()

A.The class implements java.lang.Comparable.

B.The class implements java.util.Comparator.

C.The interface used to implement sorting allows this class to define only one sort sequence.

D.The interface used to implement sorting allows this class to define many different sort sequences.


参考答案:A, C

第4题:

class A {  }  class Alpha {  private A myA = new A();  void dolt( A a ) {  a = null;  }  void tryIt() {  dolt( myA );  }  }  Which two statements are correct?()  

  • A、 There are no instanced of A that will become eligible for garbage collection.
  • B、 Explicitly setting myA to null marks that instance to be eligible for garbage collection.
  • C、 Any call on tryIt() causes the private instance of A to be marked for garbage collection.
  • D、 Private instances of A become eligible for garbage collection when instances of Alpha become eligible for garbage collection.

正确答案:B,D

第5题:

Given a class whose instances, when found in a collection of objects, are sorted by using the compareTo() method, which two statements are true?()

  • A、The class implements java.lang.Comparable.
  • B、The class implements java.util.Comparator.
  • C、The interface used to implement sorting allows this class to define only one sort sequence.
  • D、The interface used to implement sorting allows this class to define many different sort sequences.

正确答案:A,C

第6题:

Which the two demonstrate an “is a” relationship?()

  • A、 public interface Person {}  Public class Employee extends Person {}
  • B、 public interface Shape {}  public interface Rectangle extends Shape {}
  • C、 public interface Color {}  public class Shape { private Color color; }
  • D、 public class Species {}  public class Animal { private Species species; }
  • E、 interface Component {} Class Container implements Component {private Component [] children;

正确答案:B,E

第7题:

Which of the following statements are true?() 

  • A、 The equals() method determines if reference values refer to the same object.
  • B、 The == operator determines if the contents and type of two separate objects match.
  • C、 The equals() method returns true only when the contents of two objects match.
  • D、 The class File overrides equals() to return true if the contents and type of two separate objects        match.

正确答案:A,D

第8题:

Under what two circumstances is the set JspBody method NOT called in a tag class that implements the Simple Tag interface? ()

  • A、 The tag is invoked without a body.
  • B、 The doTAb method throws an exception.
  • C、 The  element has the value empty.
  • D、 The tag is called with the attribute skip-body=true

正确答案:A,C

第9题:

You want to create a filter for your web application and your filter will implement javax.servlet.Filter. Which two statements are true?()

  • A、Your filter class must implement an init method and a destroy method.
  • B、Your filter class must also implement javax.servlet.FilterChain.
  • C、When your filter chains to the next filter, it should pass the same arguments it received in its doFiltermethod.
  • D、The method that your filter invokes on the object it received that implements javax.servlet.FilterChaincan invoke either another filter or a servlet.
  • E、Your filter class must implement a doFilter method that takes, among other things, anHTTPServletRequest object and an HTTPServletResponse object.

正确答案:A,D

第10题:

Which statement is true?()

  • A、A class’s finalize() method CANNOT be invoked explicitly.
  • B、super.finalize() is called implicitly by any overriding finalize() method.
  • C、The finalize() method for a given object is called no more than once by the garbage collector.
  • D、The order in which finalize() is called on two objects is based on the order in which the two objects became finalizable.

正确答案:C

更多相关问题