Predict the output of the following program.
abstract class demo
{
public int a;
demo()
{
a = 10;
}
abstract public void set();
abstract final public void get();
}
class Test extends demo
{
public void set(int a)
{
this.a = a;
}
final public void get()
{
System.out.println("a = " + a);
}
public static void main(String[] args)
{
Test obj = new Test();
obj.set(20);
obj.get();
}
}
a = 10
a = 20
Compilation error
This question is part of this quiz :
Java Abstract Class and Interface,50 Java Language MCQs with Answers