Static

Static Variables

It is a type of variable which has a scope at a Class Level. This implies that , to access and work with such variable, there is no need to create an object of the class. The access of such variable will be as follow

figure 1.1 -Static Variable

Static Class

A static class in Java is a class that cannot be instantiated. A static class is a class that only contains static members. This cannot let us to create objects of a static class. There are several static elements in Java such as Method, Variables, Method Blocks as well as Class. Static Class can be introduced as part of our development to group related utility methods together. Of course there are built in static class part of our programming language or libraries imported to work on.

Static Class is a class that only contains static members such as methods, variables, and nested classes.. The only way to access its members using the class name itself. The following example show how to use static class.

figure 1.2-Static Class

Scroll to Top