Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Instance Initialization
class InitializerTest {
int i;
System.out.println("Instance Initialization block is called");
i = 5;
InitializerTest() {
System.out.println("Initializer Test Default Constructor is called");
InitializerTest(int x) {
System.out.println("Initializer Test Parametrized Constructor is called");
i = x;
class Main {
public static void main (String args[]){
InitializerTest obj1 = new InitializerTest();
InitializerTest obj2 = new InitializerTest(10);;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment