Multiple Choice Question

Quiz Guidelines

 

QID: 
197
Question: 

Consider the following class and interface definitions (in separate files):

public class Sample implements IInt{
public static void main(String[] args){
Sample s = new Sample(); //1
int j = s.thevalue; //2
int k = IInt.thevalue; //3
int l = thevalue; //4
}
}public interface IInt{
int thevalue = 0;
}

What will happen when the above code is compiled and run?

Select 1 option

A. It will give an error at compile time at line //1.
B. It will give an error at compile time at line //2.
C. It will give an error at compile time at line //3
D. It will give an error at compile time at line //4.
E. It will compile and run without any problem.

Q&A Set: