Which of the following statements is true? Select the one correct answer. (a) A super() or this()
Question:
Which of the following statements is true?
Select the one correct answer.
(a) A super() or this() call must always be provided explicitly as the first statement in the body of a constructor.
(b) If both a subclass and its superclass do not have any declared constructors, the implicit default constructor of the subclass will call super() when run.
(c) If neither super() nor this() is specified as the first statement in the body of a constructor, this() will implicitly be inserted as the first statement.
(d) If super() is the first statement in the body of a constructor, this() can be declared as the second statement.
(e) Calling super() as the first statement in the body of a constructor of a subclass will always work, since all superclasses have a default constructor.
Step by Step Answer:
Programmers Guide To Java SE 8 Oracle Certified Associate OCA
ISBN: 9780132930215
1st Edition
Authors: Khalid Mughal, Rolf Rasmussen