易搜题 > 资格证大类 > 计算机编程 > 问题详情
问题详情

Consider the following class:     class Test(int i) {     void test(int i) {  System.out.println(“I am an int.”); }    void test(String s) {   System.out.println(“I am a string.”);     }          public static void main(String args) {    Test t=new Test();     char ch=“y”;    t.test(ch);     }      }     Which of the statements below is true?()

A、 Line 5 will not compile, because void methods cannot be overridden.

B、 Line 12 will not compile, because there is no version of test() that rakes a charargument.

C、 The code will compile but will throw an exception at line 12.

D、 The code will compile and produce the following output: I am an int.

E、 The code will compile and produce the following output: I am a String.

未找到的试题在搜索页框底部可快速提交,在会员中心"提交的题"查看可解决状态。 收藏该题
查看答案

相关问题推荐

  • public class X {  public X aMethod() { return this;}  }  public class Y extends X {  }  Which two methods can be added to the definition of class Y?()

    A

     public void aMethod() {}

    B

     private void aMethod() {}

    C

     public void aMethod(String s) {}

    D

     private Y aMethod() { return null; }

    E

     public X aMethod() { return new Y(); }

  • Which method in the Thread class is used to create and launch a new thread of execution?()

    A、 Run();

    B、 Start();

    C、 Execute();

    D、 Run(Runnable r);

    E、 Start(Runnable r);

    F、 Execute(Thread t);

  • What is the result?()

    A、 b,3

    B、 b,8

    C、 b,13

    D、 f,3

    E、 f,8

    F、 f,13

    G、 Compilation fails.

    H、 An exception is thrown at runtime.

  • Given that the current directory is empty, and that the user has read and write privileges to the current directory, and the following: Which statement is true?()

    A、 Compilation fails.

    B、 Nothing is added to the file system.

    C、 Only a new file is created on the file system.

    D、 Only a new directory is created on the file system.

    E、 Both a new file and a new directory are created on the file system.

  • Which statements about Java code security are true?() 

    A

     The bytecode verifier loads all classes needed for the execution of a program.

    B

     Executing code is performed by the runtime interpreter.

    C

     At runtime the bytecodes are loaded, checked and run in an interpreter.

    D

     The class loader adds security by separating the namespaces for the classes of the local file system from those imported from network sources.

联系客服 会员中心
TOP