I am trying to come over to java from C++ and am having some difficulties. In C++ I could make a list of specific class instances (such as a list of an employee class, which would include name, bday etc..). In java, however I am having a harder time figuring out the same function. In C++ I would use pointers in such, in Java it appears that it is suggested to use an ArrayList. However creating an array list and feeding it class instances works, but I cant access those class instances again.
I do not really have any code examples, because I am just looking to be pointed in the right direction at this time, and just try things out. So any suggestions would be more then appreciated.
I am trying to come over to java from C++ and am having some
Share
You can do that using generics:
Take a look at the documentation of
ArrayList<E>andList<E>, which is the interface.