Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Last Updated: 4 Oct, 2016

Abstract Class

Easy

Problem statement

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();
}
}