How to separate different values in 2-d array
问题 The array has objects from different subclasses. How can I print the objects according to there subclasses? I used scanner to read student (Graduate and Undergraduate) objects and put into an array. I need to use inheritance and toString methods to get the results. Original data in txt file: G Steve 23 Biology U Julia 19 Music Flute, year: Sophomore G David 25 Math I was able to read and print the objects but only in original order: Graduate Name:Steve, Age: 23, Major: Biology Undergraduate