← Quiz: Java Classes and Objects: all 10 questions
Quiz: Java Classes and Objects · Question 1 of 10
What is true about a constructor?
What is true about a constructor?
- A.It must return void
- B.It has the same name as the class and no return type
- C.It must be static
- D.A class can have only one
Answer & explanation
Correct answer: It has the same name as the class and no return type
Constructors have no return type, share the class name, and can be overloaded.
Can you get the rest right without peeking?
Take the timed Quiz: Java Classes and Objects quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →