Possible Duplicate:
What is the use of creating a constructor for an abstract class in Java?
Example:
abstract public class AbstractDemo
{
private int ab;
public AbstractDemo()
{
ab=10;
}
public int getAb()
{
return ab;
}
public void abstractMethod()
{
//On the line below it gives error.
AbstractDemo demo=new AbstractDemo();
}
}
Edited to format code