Monday, February 19, 2018

Static Key work

The static keyword mainly use for memory management. It is a key word that are used for share the same variable or method of given class.
This is used for constant variable or method that is same for every instance of a class. In java ,if a field is declare static, then exactly a single copy of that  field is created and shared among all instances of that class.


If class has constant variable and method then we don't need to create that constant variable and method with every instance of class. That time we try to create one time that constant variable and method and refer those thing from all instance. starbuser with cripto

WOW
https://examples.javacodegeeks.com/java-basics/java-static-class-example/

Watch also another post.
What is different between static nested class and inner class(non-static class)

No comments:

Post a Comment