Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

JAVA Arraylist method?

  • 21-10-2009 9:47pm
    #1
    Closed Accounts Posts: 2


    Howdy, I have a quick question. How would you call an arraylist(from a method) that is in a different class but is in the same package? Im running Eclipse if that makes any difference.


Comments

  • Registered Users, Registered Users 2 Posts: 7,468 ✭✭✭Evil Phil


    You'd have to expose the arraylist as a property on the other class.


  • Registered Users, Registered Users 2 Posts: 1,916 ✭✭✭ronivek


    What do you mean by "call" an ArrayList?

    You probably shouldn't be returning a reference to an ArrayList from an object in general; can't you encapsulate the operations you wish to perform into methods within the Class that contains the ArrayList? And if you can't then maybe you should be looking at your design... although I may be way off track here depending on what it is you're trying to do and the type of application.


Advertisement