Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

polymorphism array with abstract class java

public abstract class Game{
  ...
}

Game games = new Game(); //Error
Game[] gamesArray = new Game[10]; //No Error
Instantiation means creation of an instance of a class. In thethis scenario, 
you've just declared a gamesArray of type Game with the size 10(just the references and nothing else). 
 That's why its not throwing any error.
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #polymorphism #array #abstract #class #java
ADD COMMENT
Topic
Name
4+1 =