Example 5: Default Constructor Hence, the Java compiler automatically creates the default constructor. The default constructor initializes any uninitialized instance variables with default values . In the above program, the variables a and b are initialized with default value 0 and false respectively.