Multiple Choice Question

Quiz Guidelines



What will be the output of compiling and running the following program:

class TestClass implements I1, I2{
public void m1() { System.out.println("Hello"); }
public static void main(String[] args){
TestClass tc = new TestClass();
( (I1) tc).m1();
}  }interface I1{
int VALUE = 1;
void m1();
}interface I2{
int VALUE = 2;
void m1();

Select 1 option

A. It will print Hello.
B. There is no way to access any VALUE in TestClass.
C. The code will work fine only if VALUE is removed from one of the interfaces.
D. It will not compile.
E. None of the above.

Q&A Set: 

Search the Web

Custom Search

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