可能重复:
How is it possible to create a sub class object within it's base class ?
class arijit
{
public static void main(String args[])
{
System.out.println("Base class main");
amit ab=new amit();
ab.a();
ab.ma();
}
public void ma()
{
System.out.println("Base class method");
}
}
class amit extends arijit
{
public void a()
{
System.out.println("Sub Class method");
ma();
}
}