单选题public class Foo {  public void main (String [] args)   {  system.out.printIn(“Hello World.”); } }  What is the result?()A  An exception is thrown.B  The code does no compile.C  “Hello World.” Is printed to the terminal.D  The program exits without pri

题目
单选题
public class Foo {  public void main (String [] args)   {  system.out.printIn(“Hello World.”); } }  What is the result?()
A

 An exception is thrown.

B

 The code does no compile.

C

 “Hello World.” Is printed to the terminal.

D

 The program exits without printing anything.

如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

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

第2题:

public class Foo {  public void main( String[] args ) {  System.out.println( “Hello” + args[0] );  }  }   What is the result if this code is executed with the command line?()

  • A、 Hello
  • B、 Hello Foo
  • C、 Hello world
  • D、 Compilation fails.
  • E、 The code does not run.

正确答案:E

第3题:

public class foo {   public static void main (Stringargs) {  String s;   system.out.printIn (“s=” + s);   }   }   What is the result?()

  • A、 The code compiles and “s=” is printed.
  • B、 The code compiles and “s=null” is printed.
  • C、 The code does not compile because string s is not initialized.
  • D、 The code does not compile because string s cannot be referenced.
  • E、 The code compiles, but a NullPointerException is thrown when toString is called.

正确答案:C

第4题:

public class foo {  public static void main (String[]args) {  String s;  system.out.printIn (“s=” + s);  }  }   What is the result?()  

  • A、 The code compiles and “s=” is printed.
  • B、 The code compiles and “s=null” is printed.
  • C、 The code does not compile because string s is not initialized.
  • D、 The code does not compile because string s cannot be referenced.
  • E、 The code compiles, but a NullPointerException is thrown when toString is called.

正确答案:C

第5题:

class A {  public A() {  System.out.println(“hello from a”);  }  }  class B extends A {  public B () {  System.out.println(“hello from b”);  super();  }  }  public class Test {  public static void main(String args[]) {  A a = new B();  }  }   What is the result when main is executed?()  

  • A、 Compilation fails.
  • B、 hello from a
  • C、 hello from b
  • D、 hello from b hello from a
  • E、 hello from a hello from b

正确答案:A

第6题:

public class Foo {   public void main (String args) {   system.out.printIn(“Hello World.”);   }   }   What is the result? () 

  • A、 An exception is thrown.
  • B、 The code does no compile.
  • C、 “Hello World.” Is printed to the terminal.
  • D、 The program exits without printing anything.

正确答案:A

第7题:

public class foo {   public static void main (stringargs)   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.

正确答案:B

第8题:

public class Foo implements Runnable (  public void run (Thread t) {  system.out.printIn(“Running.”);  }  public static void main (String[] args)  {  new thread (new Foo()).start();  } )   What is the result?()      

  • A、 An exception is thrown.
  • B、 The program exists without printing anything.
  • C、 An error at line 1 causes compilation to fail.
  • D、 An error at line 2 causes the compilation to fail.
  • E、 “Running” is printed and the program exits.

正确答案:D

第9题:

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.

正确答案:B

第10题:

public class foo {  static String s;  public static void main (String[]args) {  system.out.printIn (“s=” + s);  } }  What is the result?()  

  • A、 The code compiles and “s=” is printed.
  • B、 The code compiles and “s=null” is printed.
  • C、 The code does not compile because string s is not initialized.
  • D、 The code does not compile because string s cannot be referenced.
  • E、 The code compiles, but a NullPointerException is thrown when toString is called.

正确答案:B

更多相关问题