Question discussion

public class MyClass{ }For the above class(MyClass) what is the correct way of declaring constructor?

292890Medium 1 reply 2,051 views
-1
public class MyClass{ }For the above class(MyClass) what is the correct way of declaring constructor?
  • AMyClass(){}
  • BMyClass(void) {}
  • Cpublic MyClass(){}
  • Dpublic MyClass(void){}
  • E1 and 3
Correct answer: E

Discussion 1

0
CCommunity
1 and 3

Choice A,C are the correct answers.
The default access specifier for any constructor is same as the access specifier of class.so the options A and C are correct.