- A static method can be accessed directly from a class, while a non-static method
is accessed from the class instance. In other words we can say, static methods are
accessed by their class names which encapsulates them, while non-static methods
are accessed by object reference. Static methods cannot access instance methods
or variables within a class.
- Static methods are one per class while non-static methods are one per instance.
- Static methods cannot use non-static methods and variables without object instantiation while non-static methods can use static methods directly.
- Static methods are one per class while non-static methods are one per instance.
- Static methods cannot use non-static methods and variables without object instantiation while non-static methods can use static methods directly.
No comments:
Post a Comment