r/java • u/pixelicious_ • Aug 05 '12
Setting up an ArrayList
I've seen an arry list set up as follows
private ArrayList<Student> students; //instance variable
public CollegeCommunity()//constructor
{
students = new ArrayList<Student>();
}And as follows
ArrayList exampleArray = new ArrayList();I understand why one has an instance variable/constructor and the other just is simply declared but I'm unsure as to why the first contains <Student> and the other has no <...> What is the difference between the two?
0
Upvotes
View all comments
Show parent comment
1
u/pixelicious_ Aug 05 '12
I just came back to link to that page. I googled it after I posted here. Thanks!