‹ Back to the paper
Question 14
1 mark
Computer ScienceISC Computer Science - Competency Focused Practice Questions (CISCE, August 2024)MCQObjects
Choose the correct option.
Which of the following is a valid prototype of the non-parameterised constructor for the class Book?
- (a)public class Book {}
- (b)Book(void)
- (c)public Book( )
- (d)public Book(void)
Answer
Answer
Correct option: c
Answer: (c) public Book( ).
A non-parameterised (default) constructor has the same name as the class, no parameters and public access, exactly as public Book( ). Book(void) and public Book(void) are not valid Java syntax, and 'public class Book {}' is a class declaration, not a constructor.