How is it possible to create a sub class object within it's base class?

后端 未结 5 1629
自闭症患者
自闭症患者 2021-01-25 17:38
class arijit
{
 public static void main(String args[])
 {
  System.out.println(\"Base class main\");
  amit ab=new amit(); //how is it possible as the sub class object a         


        
5条回答
  •  孤街浪徒
    2021-01-25 18:18

    Its simple as you can create an object in the class of the same class type, you can create its subclass type too.

提交回复
热议问题