KnowledgeBoat Logo

Computer Applications

Differentiate between the following statements:
abc p = new abc();
abc p = new abc(5,7,9);

Java Constructors

27 Likes

Answer

The first statement abc p = new abc(); is calling a non-parameterised constructor to create and initialize an object p of class abc. The second statement abc p = new abc(5,7,9); is calling a parameterised constructor which accepts three arguments to create and initialize an object p of class abc.

Answered By

17 Likes


Related Questions