Static Variable and Functions
Static Variables:
1. Only one instance of a given variable exists for a class.
2. Can be accessed without the instace object
3. Can be accesable through any methods(static or nonstatic)
Static functions:
1. Can be called by prefixing the class name to the method
eg: int val = class.method();
2. No need to instanciate the class.
No comments:
Post a Comment