更多“method”相关问题
  • 第1题:

    有一个接口定义如下,下列选项中实现了该接口并且不是抽象的是( )。interface A{ int method1 (int i); int method2 (int j);}

    A.class B implements A{ int method1() { } int method2() { }}

    B.class B{int method1(int i) { }int method2(int j) { }}

    C.class B implements A{ int methodl(int i) { } int method2(intj) { }}

    D.class B extends A{int method1(int i) { }int method2(int j) { }}


    正确答案:C

  • 第2题:

    包pack1的类c_ass1中有成员方法:protected void method_1(){…},private void method_2(){…},public void method_3(){…}和 void method_4(){…},在包pack2中的类class2是class1的子类,它在class2中可以调用方法()。 

    • A、method_1
    • B、method_2
    • C、method_3
    • D、method_4

    正确答案:A,C,D

  • 第3题:

    Which two CANNOT directly cause a thread to stop executing?()

    • A、 Calling the yield method.
    • B、 Calling the wait method on an object.
    • C、 Calling the notify method on an object.
    • D、 Calling the notifyAll method on an object.
    • E、 Calling the start method on another Thread object.

    正确答案:C,D

  • 第4题:

    Under which circumstances will a thread stop?()  

    • A、The method waitforId() in class MediaTracker is called.
    • B、The run() method that the thread is executing ends.
    • C、The call to the start() method of the Thread object returns.
    • D、The suspend() method is called on the Thread object.
    • E、The wait() method is called on the Thread object.

    正确答案:B

  • 第5题:

    Which methods from the String and StringBuffer classes modify the object on which they are called?()  

    • A、The charAt() method of the String class.
    • B、The toUpperCase() method of the String class.
    • C、The replace() method of the String class.
    • D、The reverse() method of the StringBuffer class.
    • E、The length() method of the StringBuffer class.

    正确答案:D

  • 第6题:

    You are developing a custom-collection class.You need to create a method in your class. You need to ensure that the method you create in your class returns a type that is compatible with the Foreach statement. Which criterion should the method meet?()

    • A、The method must return a type of either IEnumerator or IEnumerable.
    • B、The method must return a type of IComparable.
    • C、The method must explicitly contain a collection.
    • D、The method must be the only iterator in the class.

    正确答案:A

  • 第7题:

    多选题
    Which two can directly cause a thread to stop executing?()
    A

    Exiting from a synchronized block.

    B

    Calling the wait method on an object.

    C

    Calling the notify method on an object.

    D

    Calling the notifyAll method on an object.

    E

    Calling the setPriority method on a thread object.


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

  • 第8题:

    单选题
    It is desirable that a certain method within a certain class can only be accessed by classes that are defined within the same package as the class of the method. How can such restrictions be enforced?()
    A

    Mark the method with the keyword public.

    B

    Mark the method with the keyword protected.

    C

    Mark the method with the keyword private.

    D

    Mark the method with the keyword package.

    E

    Do not mark the method with any accessibility modifiers.


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

  • 第9题:

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


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

  • 第10题:

    单选题
    Which methods from the String and StringBuffer classes modify the object on which they are called?()
    A

    The charAt() method of the String class.

    B

    The toUpperCase() method of the String class.

    C

    The replace() method of the String class.

    D

    The reverse() method of the StringBuffer class.

    E

    The length() method of the StringBuffer class.


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

  • 第11题:

    单选题
    How do you define the authentication method that will be used with AAA?()
    A

    With the method aaa command

    B

    With the method command

    C

    With a method list

    D

    With a method statement


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

  • 第12题:

    单选题
    You are developing a custom-collection class.You need to create a method in your class. You need to ensure that the method you create in your class returns a type that is compatible with the Foreach statement. Which criterion should the method meet?()
    A

    The method must return a type of either IEnumerator or IEnumerable.

    B

    The method must return a type of IComparable.

    C

    The method must explicitly contain a collection.

    D

    The method must be the only iterator in the class.


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

  • 第13题:

    指出下面哪一项是在抽象类中声明一个抽象方法。( )

    A.public abstract method();

    B.public abstract void method();

    C.public void abstract Method();

    D.public void method(){abstract;}


    正确答案:B
    解析:本题考查在Java抽象类中声明抽象方法的格式。在Java语言中,将abstract关键字修饰的类称为抽象类。与此相对应,用abstract关键字修饰的方法称为抽象方法。当一个类的定义完全表示抽象的概念时,它不应该被实例化为一个对象,因此不能为抽象类实例化对象,也就是说,abstract类必须被继承。与此相应,abstract方法必须被重写。抽象类中可以包含抽象方法,对抽象方法只须声明,而不需要实现具体的内容,格式为 abstract retumType MethodName([paramlist])。对于抽象方法声明格式,abstract关键字不能缺少,此外,还需要注意如下内容:①声明格式中没有{};②最后的“;”不能缺少;③可以用public 或 protected关键字来修饰。选项A错误,缺少返回类型;选项B正确;选项C错误,返回类型要跟在abstxact后面;选项D错误,抽象方法中不需要有具体的实现内容,更不需要{}。

  • 第14题:

    在Java语言中,包pack1的类class1中有成员方法:  protected void  method_1(){„},  private void method_2() {„},  public void method_3() {„}  和  void method_4() {„},  在包pack2中的类class2不是class1的子类,你在class2中可以调用方法()。 

    • A、method_1
    • B、method_2
    • C、method_3
    • D、method_4

    正确答案:C

  • 第15题:

    How do you define the authentication method that will be used with AAA?()

    • A、With the method aaa command
    • B、With the method command
    • C、With a method list
    • D、With a method statement

    正确答案:C

  • 第16题:

    It is desirable that a certain method within a certain class can only be accessed by classes that are defined within the same package as the class of the method. How can such restrictions be enforced?()  

    • A、Mark the method with the keyword public.
    • B、Mark the method with the keyword protected.
    • C、Mark the method with the keyword private.
    • D、Mark the method with the keyword package.
    • E、Do not mark the method with any accessibility modifiers.

    正确答案:E

  • 第17题:

    Which two CANNOT directly cause a thread to stop executing? ()  

    • A、 Existing from a synchronized block.
    • B、 Calling the wait method on an object.
    • C、 Calling notify method on an object.
    • D、 Calling read method on an InputStream object.
    • E、 Calling the SetPriority method on a Thread object.

    正确答案:A,C

  • 第18题:

    单选题
    Under which circumstances will a thread stop?()
    A

    The method waitforId() in class MediaTracker is called.

    B

    The run() method that the thread is executing ends.

    C

    The call to the start() method of the Thread object returns.

    D

    The suspend() method is called on the Thread object.

    E

    The wait() method is called on the Thread object.


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

  • 第19题:

    多选题
    Which two CANNOT directly cause a thread to stop executing? ()
    A

    Calling the yield method.

    B

    Calling the wait method on an object.

    C

    Calling the notify method on an object.

    D

    Calling the notifyAll method on an object.

    E

    Calling the start method on another Thread object.


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

  • 第20题:

    单选题
    M类中有一个没有形式参数,且没有返回值的方法method,若要使得用M.method()就可以调用该方法,则method方法的方法头的正确形式应该是()。
    A

    static void method()

    B

    public method()

    C

    final void method()

    D

    static method()


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

  • 第21题:

    多选题
    Which two CANNOT directly cause a thread to stop executing? ()
    A

    Existing from a synchronized block.

    B

    Calling the wait method on an object.

    C

    Calling notify method on an object.

    D

    Calling read method on an InputStream object.

    E

    Calling the SetPriority method on a Thread object.


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

  • 第22题:

    多选题
    class A {  protected int method1(int a, int b) { return 0; }  }  Which two are valid in a class that extends class A?()
    A

    public int method1(int a, int b) { return 0; }

    B

    private int method1(int a, int b) { return 0; }

    C

    private int method1(int a, long b) { return 0; }

    D

    public short method1(int a, int b) { return 0: }

    E

    static protected int method1(int a, int b) { return 0; }


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

  • 第23题:

    单选题
    Click the Exhibit button and examine the diagram.  You are running a database that takes advantage of features provided by Connection Manager, heterogeneous services, and external procedures. The diagram depicts the components used for the naming method you just configured. Which naming method are you using?()
    A

    Host naming method.

    B

    Local naming method.

    C

    Directory naming method.

    D

    External naming method.


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

  • 第24题:

    多选题
    Which two can be used to create a new Thread?()
    A

    Extend java.lang.Thread and override the run method.

    B

    Extend java.lang.Runnable and override the start method.

    C

    Implement java.lang.thread and implement the run method.

    D

    Implement java.lang.Runnable and implement the run method.

    E

    Implement java.lang.Thread and implement the start method.


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