Created
July 9, 2019 16:09
-
-
Save anjanashankar9/717e2d0331d5bdff8f0bb6ed25997771 to your computer and use it in GitHub Desktop.
Java - Static Initializer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class StaticTest { | |
static int i; | |
static { | |
System.out.println("Static Initialization block is called"); | |
i = 10; | |
} | |
StaticTest() { | |
System.out.println("Static Test Constructor is called"); | |
} | |
} | |
class Main { | |
public static void main (String args[]){ | |
System.out.println(StaticTest.i); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment