ExamVeda
Login
Home
Constructors and Methods
?

What is the prototype of the default constructor?
public class Test { }

Answer & Solution
Correct Answer: Option D

Option A and B are wrong because they use the default access modifier and the access modifier for the class is public (remember, the default constructor has the same access modifier as the class).

Option C is wrong. The void makes the compiler think that this is a method specification - in fact if it were a method specification the compiler would spit it out.

Examveda
Question posted by Examveda
Community

Join the Discussion

2 Comments
Santosh Kabir
Santosh Kabir 7 years ago
Even if class is defined public, default constructor need Not be defined as public.
Pls check.
Vinothini K
Vinothini K 8 years ago
You mentioned answer is option D.but while explaining answer you mention option D is wrong by mistakely.Please edit this.Thank you