View Single Post
  #3 (permalink)  
Old 07-26-2007, 10:09 AM
shanePreater shanePreater is offline
Member
 
Join Date: Jul 2007
Location: England, Bath
Posts: 47
shanePreater is on a distinguished road
Remember though that if you are going to make the method static any member variables that you use with in the method will also need to be static

For example:
In your code I would assume that internally you are using a collection so:
Code:
public class CatCollection { private static List<Cat> cats = new ArrayList<Cat>; public CatCollection() { ......... } public static void addCat(Cat aCat) { //adds a Cat object to an array in CatCollection cats.add(cat); } }
The other thing that you need to bare in mind when doing this kind of operation is that if you do instantiate the CatCollection class there will still only be one instance of the cats collection as it is declared static.
__________________
Shane Preater -
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Reply With Quote