Multiple Choice Question

Quiz Guidelines

 

QID: 
14
Tags: 
Validated against: 
java8
Question: 

Given:

public class HelloWorld{

  public static void main (String[] args)
  {
    System.out.println("Hello World!");
  }

}

Select 1 option below, if the above class is declared in a file Hello.java:

A. Compilation will fail

B. Compilation succeeds, but execution fails with an exception

C. Compilation and execution succeeds and it prints 'Hello World!'

D. Compilation and execution succeeds and it prints nothing.

Q&A Set: