+ 2

Java help

if pokemon is the superclass and pikachu is the subclass what is the difference between Pokemon p1=new Pokemon(); and Pokemon p1=new Pikachu();?

26th Oct 2017, 12:41 PM
oyl
2 Answers
0
New pikachu() uses the pikachu subclasses constructor. Alternatively, new pokemon() uses the Pokemon superclass constructor.
26th Oct 2017, 1:11 PM
josh mizzi
josh mizzi - avatar
0
what does it mean in the case of casting?
27th Oct 2017, 2:18 AM
oyl