Multiple Choice Question

Quiz Guidelines



What will the following class print when compiled and run?

class Holder{
int value = 1;
Holder link;
public Holder(int val){ this.value = val; }
public static void main(String[] args){
final Holder a = new Holder(5);
Holder b = new Holder(10); = b; = setIt(a, b);
System.out.println(" ";
public static Holder setIt(final Holder x, final Holder y){ =;
return x;

Select 1 option

A. It will not compile because 'a' is final.
B. It will not compile because method setIt() cannot change
C. It will print 5, 10.
D. It will print 10, 10.
E. It will throw an exception when run.

Q&A Set: