Loading…
Loading…
Ten exam-style questions on creating objects: constructors versus look-alike methods, the default constructor, field defaults, instance initializer blocks, forward references, chained constructors and the order of initialization, with explanations.
Practice questions for the article Creating Objects in Java: Constructors, Instance Initializers and Order of Initialization.
The questions follow Java 21 rules, as on the 1Z0-830 exam, unless a question says otherwise. For output questions, trace the code line by line: field initializers and { } blocks first, in file order, then the constructor body. Aim for at least 8 out of 10 before moving on.
Quiz path: step 4. Take the quizzes in this order, after reading each article.
Previous quiz: Packages, Imports, Compiling and the Class Path (OCP 21)
Next quiz: Primitive Types, Literals, Wrapper Classes and Text Blocks (OCP 21)
10 questions · pass at 68%
Check your understanding; you see the answers and explanations after submitting.
Discussion
Sign in to ask a question or share what you learned.