Adding instances of a class to an Arraylist in java
        Posted  
        
            by Olga
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Olga
        
        
        
        Published on 2010-04-20T12:04:30Z
        Indexed on 
            2010/04/20
            12:13 UTC
        
        
        Read the original article
        Hit count: 294
        
I have 10 instances of the class movie which I wish to add to an Arraylist named Catalogue1
in a class containing a main method I write the following
 ArrayList catalogue1= new ArrayList ()
   //the class movie is defined in another class
    Movie movie1= new Movie ()
   Movie movie2= new Movie ()
 Catalogue.Add (1, movie1)
What is wrong? Should I define somewhere what kind of Objects this arraylist named catalogue should contain?
Thank you in advance
© Stack Overflow or respective owner