多选题Which of the following statements are true?()AThe equals() method determines if reference values refer to the same object.BThe == operator determines if the contents and type of two separate objects match.CThe equals() method returns true only when the

题目
多选题
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.


相似考题
更多“多选题Which of the following statements are true?()AThe equals() method determines if reference values refer to the same object.BThe == operator determines if the contents and type of two separate objects match.CThe equals() method returns true only when the”相关问题
  • 第1题:

    Which of the following statements about variables and scope are true?() 

    • A、 Local variables defined inside a method are destroyed when the method is exited.
    • B、 Local variables are also called automatic variables.
    • C、 Variables defined outside a method are created when the object is constructed.
    • D、 A method parameter variable continues to exist for as long as the object is needed in which the method is defined.

    正确答案:A,B,C

  • 第2题:

    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

  • 第3题:

    public class Person {  private name;  public Person(String name) {  this.name = name;  }  public boolean equals(Object o) {  if( !o instanceof Person ) return false;  Person p = (Person) o;  return p.name.equals(this.name);  }  }  Which is true?() 

    • A、 Compilation fails because the hashCode method is not overridden.
    • B、 A HashSet could contain multiple Person objects with the same name.
    • C、 All Person objects will have the same hash code because the hashCode method is not overridden.
    • D、 If a HashSet contains more than one Person object with name=”Fred”, then removing another person, also with name=”Fred”, will remove them all.

    正确答案:B

  • 第4题:

    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

  • 第5题:

    多选题
    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
    解析: 严格来说这个问题的答案是不确定的,因为equals()方法是可以被重载的,但是按照java语言的本意来说:如果没有重写(override)新类的equals(),则该方法和 == 操作符一样在两个变量指向同一对象时返回真,但是java推荐的是使用equals()方法来判断两个对象的内容是否一样,就像String类的equals()方法所做的那样:判定两个String对象的内容是否相同,而==操作符返回true的唯一条件是两个变量指向同一对象。从这个意义上来说选择给定的答案。从更严格的意义来说正确答案应该只有D。

  • 第6题:

    多选题
    Which three statements are true?()
    A

    The default constructor initializes method variables.

    B

    The default constructor has the same access as its class.

    C

    The default constructor invoked the no-arg constructor of the superclass.

    D

    If a class lacks a no-arg constructor, the compiler always creates a default constructor.

    E

    The compiler creates a default constructor only when there are no other constructors for the class.


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

  • 第7题:

    多选题
    Which two are true?()
    A

    A finalizer may NOT be invoked explicitly.

    B

    The finalize method declared in class Object takes no action.

    C

    super.finalize()is called implicitly by any over riding finalize method.

    D

    The finalize method for a given objec twill be called no more than once by the garbage collector.

    E

    The order in which finalize will be called on two objects is based on the order in which the two objects became finalizable.


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

  • 第8题:

    单选题
    public class Person {  private name;  public Person(String name) {  this.name = name;  }  public boolean equals(Object o) {  if( !o instanceof Person ) return false;  Person p = (Person) o;  return p.name.equals(this.name);  }  }  Which is true?()
    A

     Compilation fails because the hashCode method is not overridden.

    B

     A HashSet could contain multiple Person objects with the same name.

    C

     All Person objects will have the same hash code because the hashCode method is not overridden.

    D

     If a HashSet contains more than one Person object with name=”Fred”, then removing another person, also with name=”Fred”, will remove them all.


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

  • 第9题:

    多选题
    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.


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

  • 第10题:

    多选题
    Which of the following statements about variables and their scopes are true? ()
    A

    Instance variables are member variables of a class.

    B

    Instance variables are declared with the static keyword.

    C

    Local variables defined inside a method are created when the method is executed.

    D

    Local variables must be initialized before they are used.


    正确答案: B,D
    解析: 类中有几种变量,分别是:局部变量(英文可以为:local/automatic/temporary/stack variable)是定义在方法里的变量;实例变量(英文为:instance variable)是在方法外而在类声明内定义的变量,有时也叫成员变量;类变量(英文为:class variable)是用关键字static声明的实例变量,他们的生存期分别是:局部变量在定义该变量的方法被调用时被创建,而在该方法退出后被撤销;实例变量在使用new Xxxx()创建该类的实例时被创建,而其生存期和该类的实例对象的生存期相同;类变量在该类被加载时被创建,不一定要用new Xxxx()创建,所有该类的实例对象共享该类变量,其生存期是类的生存期。任何变量在使用前都必须初始化,但是需要指出的是局部变量必须显式初始化,而实例变量不必,原始类型的实例变量在该类的构造方法被调用时为它分配的缺省的值,整型是0,布尔型是false,而浮点型是0.0f,引用类型(类类型)的实例变量的缺省值是null(没有进行实际的初始化,对它的使用将引起NullPointException),类变量的规则和实例变量一样,不同的是类变量的初始化是在类被加载时。

  • 第11题:

    多选题
    Which two statements are true about the hashCode method?()
    A

    The hashCode method for a given class can be used to test for object equality and object inequality for that class.

    B

    The hashCode method is used by the java.util.SortedSet collection class to order the elements within that set.

    C

    The hashCode method for a given class can be used to test for object inequality, but NOT objecte quality, for that class.

    D

    The only important characteristic of the values returned by a hashCode method is that the distribution of values must follow a Gaussian distribution.

    E

    The hashCode method is used by the java.util.HashSet collection class to group the elements within that set into hash buckets for swift retrieval.


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

  • 第12题:

    多选题
    Given that b and c refer to instances of wrapper classes, which two statements are true?()
    A

    b.equals(b) returns true.

    B

    b.equals(c) returns the same result as b == c.

    C

    b.eqials(c) can return false even if c.equals(b) returns true.

    D

    b.equals(c) throws an exception if b and c are different wrapper types.

    E

    b.equals(c) returns false if the type of wrapper objects being compared are different.


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

  • 第13题:

    Given that b and c refer to instances of wrapper classes, which two statements are true?()

    • A、 b.equals(b) returns true.
    • B、 b.equals(c) returns the same result as b == c.
    • C、 b.eqials(c) can return false even if c.equals(b) returns true.
    • D、 b.equals(c) throws an exception if b and c are different wrapper types.
    • E、 b.equals(c) returns false if the type of wrapper objects being compared are different.

    正确答案:B,C

  • 第14题:

    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

  • 第15题:

    Which two statements are true about using the isUserInRole method to implement security in a Java EEapplication?()

    • A、It can be invoked only from the doGet or doPost methods.
    • B、It can be used independently of the getRemoteUser method.
    • C、Can return "true" even when its argument is NOT defined as a valid role name in the deployment descriptor.
    • D、Using the isUserInRole method overrides any declarative authentication related to the method in which it is invoked.

    正确答案:B,C

  • 第16题:

    Which two statements are true about the hashCode method?()

    • A、The hashCode method for a given class can be used to test for object equality and object inequality for that class.
    • B、The hashCode method is used by the java.util.SortedSet collection class to order the elements within that set.
    • C、The hashCode method for a given class can be used to test for object inequality, but NOT objecte quality, for that class.
    • D、The only important characteristic of the values returned by a hashCode method is that the distribution of values must follow a Gaussian distribution.
    • E、The hashCode method is used by the java.util.HashSet collection class to group the elements within that set into hash buckets for swift retrieval.

    正确答案:C,E

  • 第17题:

    多选题
    Which two statements are true regarding the return values of property written hashCode and equals methods from two instances of the same class?()
    A

    If the hashCode values are different, the objects might be equal.

    B

    If the hashCode values are the same, the object must be equal.

    C

    If the hashCode values are the same, the objects might be equal.

    D

    If the hashCode values are different, the objects must be unequal.


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

  • 第18题:

    单选题
    Which of the following statements about Vandergrift's research is TRUE?
    A

    The participants were postgraduates learning French as a second language.

    B

    All the participants were taught using the conventional method, with the focus on listening strategies.

    C

    The two groups were taught by different teachers.

    D

    The participants were at the same initial skill level.


    正确答案: A
    解析:

  • 第19题:

    多选题
    Part of the job as a network administrator is being able to make a distinction between routed protocols and routing protocols. Which of the following statements is true regarding them?()
    A

    A routing protocol is assigned to an interface and determines the method of packet delivery.

    B

    A routed protocol is assigned to an interface and determines the method of packet delivery.

    C

    A routing protocol determines the path of a packet through a network.

    D

    A routed protocol determines the path of a packet through a network.

    E

    A routing protocol operates at the transport layer of the OSI model.

    F

    A routed protocol updates the routing table of a router.


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

  • 第20题:

    单选题
    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
    解析: 暂无解析

  • 第21题:

    多选题
    Which of the following statements regarding routed and routing protocols are true?()
    A

    A routed protocol is assigned to an interface and determines the method of packet deliver.

    B

    A routing protocol determines the path of a packet through a network.

    C

    A routed protocol determines the path of a packet through a network.

    D

    A routing protocol operates at the transport layer of the OSI model.

    E

    A routed protocol updates the routing table of a router.


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

  • 第22题:

    单选题
    Which of the following statements is true concerning simple parallel resistance circuits?()
    A

    The total current flow equals the sum of the individual currents

    B

    The total current flow equals the reciprocal of the sum of the individual currents

    C

    The total resistance equals the sum of the individual resistance

    D

    The total voltage equals the sum of the individual voltages across each resistance


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

  • 第23题:

    多选题
    Which two statements are true about using the isUserInRole method to implement security in a Java EEapplication?()
    A

    It can be invoked only from the doGet or doPost methods.

    B

    It can be used independently of the getRemoteUser method.

    C

    Can return true even when its argument is NOT defined as a valid role name in the deployment descriptor.

    D

    Using the isUserInRole method overrides any declarative authentication related to the method in which it is invoked.


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

  • 第24题:

    多选题
    Which of the following statements about variables and scope are true?()
    A

    Local variables defined inside a method are destroyed when the method is exited.

    B

    Local variables are also called automatic variables.

    C

    Variables defined outside a method are created when the object is constructed.

    D

    A method parameter variable continues to exist for as long as the object is needed in which the method is defined.


    正确答案: B,D
    解析: 本题是讨论变量的类型及作用域。