Skip to main content
Uses of static and non static block in Java
Static block
- Static block is used to initialize the static data members and it is executed before main method starts execution.
- Static block can be used to reuse the common code between multiple static methods in a class.
Non Static block
- Non Static block is used to reuse the common code between all constructor of class.
Comments
Post a Comment