PDA

View Full Version : Why getCountStudent() method is called using Class Name instead of first making new



saneha
04-28-2011, 09:06 PM
Why getCountStudent() method is called using Class Name instead of first making new object of class and then calling getCoubtStudent() method using that object??? Please explain sir

Vuhelper
04-28-2011, 09:10 PM
The static data members and methods are associated with class and are not tied to any object. There will be only single copy of static data member inside a class. The static data members are shared by all the objects of class. The static method getCountStudent() can be accessed by class as well as object of the class.