niusouti.com

单选题public class foo {  public static void main (string[]args)  try {return;}  finally {system.out.printIn(“Finally”);}  }  What is the result?()AThe program runs and prints nothing.BThe program runs and prints “Finally”CThe code compiles, but an exception

题目
单选题
public class foo {  public static void main (string[]args)  try {return;}  finally {system.out.printIn(“Finally”);}  }  What is the result?()
A

 The program runs and prints nothing.

B

 The program runs and prints “Finally”

C

 The code compiles, but an exception is thrown at runtime.

D

 The code will not compile because the catch block is missing.


相似考题
更多“public class foo {  public static void main (string[]args) ”相关问题
  • 第1题:

    以下是JAVA中正确的入口方法是? () 

    • A、 public static void main(String[] args){}
    • B、 public static void main(String args){}
    • C、 public void main(String[] args){}
    • D、 public static int main(String[] args){}

    正确答案:A

  • 第2题:

    public class Test {   public static void main (String args) {  string foo = “blue”;  string bar = foo;   foo = “green”;   System.out.printIn(bar);   }   }   What is the result?()  

    • A、 An exception is thrown.
    • B、 The code will not compile.
    • C、 The program prints “null”
    • D、 The program prints “blue”
    • E、 The program prints “green”

    正确答案:D

  • 第3题:

    public class Base {  public static final String FOO = “foo”;  public static void main(String[] args) {  Base b = new Base();  Sub s = new Sub();  System.out.print(Base.FOO);  System.out.print(Sub.FOO);  System.out.print(b.FOO);  System.out.print(s.FOO);  System.out.print(((Base)s).FOO);  } }  class Sub extends Base {public static final String FOO=bar;}  What is the result?() 

    • A、 foofoofoofoofoo
    • B、 foobarfoobarbar
    • C、 foobarfoofoofoo
    • D、 foobarfoobarfoo
    • E、 barbarbarbarbar
    • F、 foofoofoobarbar
    • G、 foofoofoobarfoo

    正确答案:D

  • 第4题:

    下列有关main()方法的签名正确的是哪些?()

    • A、 public static void main(String[] args){}
    • B、 public static void main(){}
    • C、 public static void main(String args[]){}
    • D、 public void static main(String[] args){}

    正确答案:A,C

  • 第5题:

    作为Java应用程序入口的main方法,其声明格式可以是()。

    • A、public static void main(String[] args)
    • B、public static int main(String[] args)
    • C、public void main(String[] args)
    • D、public int main(String[] args)

    正确答案:A

  • 第6题:

    public class Test {  public static void main( String[] args) {  String foo = args[1];  String bar = args[2];  String baz = args[3];  System.out.println(“baz = “ + baz); }  }   And the command line invocation: java Test red green blue   What is the result?()  

    • A、 baz =
    • B、 baz = null
    • C、 baz = blue
    • D、 Compilation fails.
    • E、 An exception is thrown at runtime.

    正确答案:E

  • 第7题:

    public class Test {  public static void main(String args[]) {  class Foo {  public int i = 3; }  Object o = (Object)new Foo();   Foo foo = (Foo)o;  System.out.println(“i = “ + foo.i); }  }  What is the result?()  

    • A、 i = 3
    • B、 Compilation fails.
    • C、 A ClassCastException is thrown at line 6.
    • D、 A ClassCastException is thrown at line 7.

    正确答案:A

  • 第8题:

    public class test(   public static void main(stringargs){   string foo = args [1];   string foo = args ;   string foo = args ;   }   )   And command line invocation:  Java Test red green blue  What is the result? () 

    • A、 Baz has the value of “”
    • B、 Baz has the value of null
    • C、 Baz has the value of “red”
    • D、 Baz has the value of “blue”
    • E、 Bax has the value of “green”
    • F、 The program throws an exception.

    正确答案:F

  • 第9题:

    单选题
    public class test(  public static void main(string[]args){  string foo = args [1];  string foo = args [2];  string foo = args [3];  }  )  And command line invocation: Java Test red green blue   What is the result?()
    A

     Baz has the value of “”

    B

     Baz has the value of null

    C

     Baz has the value of “red”

    D

     Baz has the value of “blue”

    E

     Bax has the value of “green”

    F

     The program throws an exception.


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

  • 第10题:

    单选题
    public class test(   public static void main(stringargs){   string foo = args [1];   string foo = args ;   string foo = args ;   }   )   And command line invocation:  Java Test red green blue  What is the result? ()
    A

     Baz has the value of “”

    B

     Baz has the value of null

    C

     Baz has the value of “red”

    D

     Baz has the value of “blue”

    E

     Bax has the value of “green”

    F

     The program throws an exception.


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

  • 第11题:

    单选题
    public class Test {  public static void main(String args[]) {  class Foo {  public int i = 3; }  Object o = (Object)new Foo();   Foo foo = (Foo)o;  System.out.println(“i = “ + foo.i); }  }  What is the result?()
    A

     i = 3

    B

     Compilation fails.

    C

     A ClassCastException is thrown at line 6.

    D

     A ClassCastException is thrown at line 7.


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

  • 第12题:

    单选题
    public class Base {  public static final String FOO = “foo”;  public static void main(String[] args) {  Base b = new Base();  Sub s = new Sub();  System.out.print(Base.FOO);  System.out.print(Sub.FOO);  System.out.print(b.FOO);  System.out.print(s.FOO);  System.out.print(((Base)s).FOO);  } }  class Sub extends Base {public static final String FOO=bar;}  What is the result?()
    A

     foofoofoofoofoo

    B

     foobarfoobarbar

    C

     foobarfoofoofoo

    D

     foobarfoobarfoo

    E

     barbarbarbarbar

    F

     foofoofoobarbar

    G

     foofoofoobarfoo


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

  • 第13题:

    public class test(  public static void main(string[]args){  string foo = args [1];  string foo = args [2];  string foo = args [3];  }  )  And command line invocation: Java Test red green blue   What is the result?()  

    • A、 Baz has the value of “”
    • B、 Baz has the value of null
    • C、 Baz has the value of “red”
    • D、 Baz has the value of “blue”
    • E、 Bax has the value of “green”
    • F、 The program throws an exception.

    正确答案:F

  • 第14题:

    Which declarations will allow a class to be started as a standalone program?()  

    • A、public void main(String args[])
    • B、public void static main(String args[])
    • C、public static main(String[] argv)
    • D、final public static void main(String [] array)
    • E、public static void main(String args[])

    正确答案:D,E

  • 第15题:

    Public class test (  Public static void main (String args[])  (  System.out.printIn (6 ^ 3);  )  )   What is the output?()


    正确答案:5

  • 第16题:

    下面哪些选项是正确的main方法说明?()

    • A、 public main(String args[])
    • B、 public static void main(String args[])
    • C、 private static void main(String args[])
    • D、 void main()

    正确答案:B

  • 第17题:

    声明Java独立应用程序main()方法时,正确表达是()。

    • A、public static void main(String[]args){…}
    • B、private static void main(String args[]){…}
    • C、public void main(String args[]){…}
    • D、public static void main(){…}

    正确答案:A

  • 第18题:

    public class Foo {  static int[] a;  static { a[0]=2; }  public static void main( String[] args) {}  }  Which exception or error will be thrown when a programmer attempts to run this code?() 

    • A、 java.lang. StackOverflowError
    • B、 java.lang.IllegalStateException
    • C、 java.lang.ExceptionlnlnitializerError
    • D、 java.lang.ArraylndexOutOfBoundsException

    正确答案:C

  • 第19题:

    public class Foo {  public static void main(String[] args) {  try {  return;  } finally {  System.out.println( “Finally” );  }  }  }  What is the result?()

    • A、 Finally
    • B、 Compilation fails.
    • C、 The code runs with no output.
    • D、 An exception is thrown at runtime.

    正确答案:A

  • 第20题:

    下面哪些main方法可用于程序执行()

    • A、public static void main(String[]args)
    • B、public static void main(String[]x)
    • C、public static void main(Stringargs[])
    • D、public void main(String[]args)

    正确答案:A,B,C

  • 第21题:

    多选题
    Which declarations will allow a class to be started as a standalone program?()
    A

    public void main(String args[])

    B

    public void static main(String args[])

    C

    public static main(String[] argv)

    D

    final public static void main(String [] array)

    E

    public static void main(String args[])


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

  • 第22题:

    单选题
    public class Test {  public static void main (String [] args)  {  string foo = “blue”;  string bar = foo;  foo = “green”;  System.out.printIn(bar);  }  }   What is the result?()
    A

     An exception is thrown.

    B

     The code will not compile.

    C

     The program prints “null”

    D

     The program prints “blue”

    E

     The program prints “green”


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

  • 第23题:

    单选题
    以下是JAVA中正确的入口方法是? ()
    A

     public static void main(String[] args){}

    B

     public static void main(String args){}

    C

     public void main(String[] args){}

    D

     public static int main(String[] args){}


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

  • 第24题:

    单选题
    下面哪些选项是正确的main方法说明?()
    A

     public main(String args[])

    B

     public static void main(String args[])

    C

     private static void main(String args[])

    D

     void main()


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