classes

Quiz Guidelines

 

Multiple Choice Question

QID: 
14

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.

Multiple Choice Question

QID: 
13

Given:

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.