View Single Post
  #2 (permalink)  
Old 03-07-2008, 11:08 PM
hardwired hardwired is offline
Senior Member
 
Join Date: Jul 2007
Posts: 1,104
hardwired is on a distinguished road
"noOfEmployees" does not belong in the Employee class. An Employee cannot always know about other employees or how many there are. The static modifier will allow this variable to be changed by any Employee instance. The class that has the ArrayList/Collection of employees is the one who should keep this information, ie, "noOfEmployees". Whoever is adding the employees must/will have acces to this information.
Reply With Quote