ProAnswers.org

If a class doesn't have any constructors, what will happen?

If a class doesn’t have a constructor, the JVM will provide a default constructor for the class.

Class A

{

int a;

Void show() { }

public static void main()

{

A ob=new A();

}

} In above program there is no constructor because system provide one Default constructor and initialize the a value is equal to zero.