Select Page

Static Method and Variable Assignment Help

Purpose of Static Method and Static Variable

Purpose of Static method and Static Variable

Purpose of Static method and Static Variable

Static:

It is used to manage the main memory. It is applied in inner classes, methods, blocks and variables.

Static Variable:

For declaring the static variable you need to put a static keyword with a variable in declaring therefore it is called a static variable and it occupied the memory at once when the class loads which means that it saves memory. It contains the very simpler property of the non-similar or unique objects.

Static Method:

It is a method that goes to a class moderately than an instance. It is reachable to every instance of a class but through its only member of a class and a method name with a dot. But there is a huge drawbacks of static method that it cannot be reachable to every instance methods or variables. Its methods can access anywhere without creating a new object and make a memory larger.

Share This