Display the arrays i get from classes

后端 未结 1 539
我寻月下人不归
我寻月下人不归 2021-01-29 04:29

First,I dont want to tell me about abstract class,inherit each.Its just Stereo,Ygro,Aerio classes that starts like public class Stereo{//code inside } there arent ectended any c

相关标签:
1条回答
  • 2021-01-29 05:27

    EDITED:

    Food[] pin = new Food[A];
    

    This is an array of type Food. It can hold objects of type food and other types of food (pizza, corn, potato), which are extended from Food. If you did not extend your Stereo class from Food, for example, then you cannot store any instances of it in this array.

    Look at this tutorial, or find another one on generic inheritance, to help you understand this concept.

    http://self-learning-java-tutorial.blogspot.com/2014/03/generics-and-inheritance.html

    0 讨论(0)
提交回复
热议问题