niusouti.com
更多“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题:

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

    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错误,抽象方法中不需要有具体的实现内容,更不需要{}。

  • 第3题:

    在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

  • 第4题:

    为AB类的一个无形式参数无返回值的方法method书写方法头,使得使用类名AB作为前缀就可以调用它,该方法头的形式为()

    • A、 static  void  method( )
    • B、 public  void  method( )
    • C、 final  void  method( )
    • D、 abstract  void  method( )

    正确答案:A

  • 第5题:

    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

  • 第6题:

    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

  • 第7题:

    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

  • 第8题:

    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

  • 第9题:

    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.

    正确答案:B

  • 第10题:

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

  • 第11题:

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


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

  • 第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.


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

  • 第13题:

    类Test定义如下,将下列哪个方法插入③行处是不合法的( )?

    ① public class Test{

    ② public float Method(float a,float B) { }

    ③ ______

    ④ }

    A.public float Method(float a,float b,float C) { }

    B.public float Method(float c,float d){ }

    C.public int Method(int a,int B) { }private float Method(int a,int b,int C) { }

    D.private float Method(int a,int b,int C) { }


    正确答案:B
    解析:本题主要考查方法重载,方法的重载是指多个方法可以享有相同的名字,但参数的数量或类型必须不相同(采用不同的形式参数列表),选项B不符合方法重载的要求。

  • 第14题:

    There are many different ways of presenting grammar in the classroom. Among them, three are most frequently used and discussed. Which one does not be|ong to them?

    A.The deductive method.
    B.The inductive method.
    C.The guided discovery method.
    D.The productive method.

    答案:D
    解析:
    考查语法教学。常用的三种语法教学法有:演绎法(deductive method)、归纳法(inductive method)和指导发现法(guided discovery metllod)。因此答案为D。

  • 第15题:

    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

  • 第16题:

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

    • A、static void method()
    • B、public method()
    • C、final void method()
    • D、static method()

    正确答案:A

  • 第17题:

    包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

    正确答案:A,C

  • 第18题:

    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

  • 第19题:

    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

  • 第20题:

    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

  • 第21题:

    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

  • 第22题:

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


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

  • 第23题:

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

  • 第24题:

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