Saturday, 23 November 2019

SE - 13 - Static and non-Static Methods !!

- We can call static methods directly while we can not call non static methods directly. You need to create and instantiate an object of class for calling non static methods.

- Non static stuff (methods, variables) can not be accessible Inside static methods Means we can access only static stuff Inside static methods. Opposite to It, Non static method do not have any such restrictions. We can access static and non static both kind of stuffs Inside non static methods

- Static method Is associated with the class while non static method Is associated with an object.

- Static methods can't be overrided in java. If we try to override a static method Java treats it as a new method and rule of parent/child doesn't applies to it

-Static methods can be overloaded in JAVA with rules of overloading

No comments:

Post a Comment