class ParameterConstructor { private int var; //default constructor public Example2() { this.var = 10; } //parameterized constructor public Example2(int num) { this.var = num; } public int getValue() { return var; } public static void main(String args[]) { ParameterConstructor obj = new Example2(); ParameterConstructor obj2 = new Example2(100); System.out.println("var is: "+obj.getValue()); System.out.println("var is: "+obj2.getValue()); } }