Question discussion

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

318743Medium 1 reply 1,125 views
32
public class Test { }What is the prototype of the default constructor?
  • Apublic Test(void)
  • BTest( )
  • CTest(void)
  • Dpublic Test( )
  • ENone of these
Correct answer: D

Discussion 1

0
CCommunity
public Test( )

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.