Multiple Choice Question

Quiz Guidelines

 

QID: 
299
Question: 

Consider the following class definition:

public class TestClass{
public static void main(){ new TestClass().sayHello(); } //1
public static void sayHello(){ System.out.println("Static Hello World"); public void sayHello() { System.out.println("Hello World "); } //3
}

What will be the result of compiling and running the class?

Select 1 option

A. It will print Hello World.
B. It will print Static Hello World.
C. Compilation error at line 2.
D. Compilation error at line 3.
E. Runtime Error.

Q&A Set: 

Search the Web

Custom Search

Searches whole web. Use the search in the right sidebar to search only within javajee.com!!!