Which of the following statements are true?
1) The default constructor has a return type of void
2) The default constructor takes a parameter of void
3) The default constructor takes no parameters
4) The default constructor is not created if the class has any constructors of its own.
Answer :
3) The default constructor takes no parameters
4) The default constructor is not created if the class has any constructors of its own.
Option 1 is fairly obviously wrong as constructors never have a return type. Option 2 is very dubious as well as Java does not offer void as a type for a method or constructor.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment