Say I have a Class called ParentClass and a Class called ChildClass
The ParentClass is abstract and the ChildClass extends the ParentClass per Java terminology. Furthermore, the ParentClass has a constructor which takes an int as a parameter. Now in another class I want to instantiate the ChildClass. I have tried the two below ways:
ChildClass obj1 = new ChildClass(5)ParentClass obj2 = new ChildClass(5)
Java allows me to use any of the two above ways. My question is, is there actually any difference? Can I use the two, interchangeably if I want to ?