📜  具有抽象类java代码示例的多态数组

📅  最后修改于: 2022-03-11 14:52:23.558000             🧑  作者: Mango

代码示例1
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.