Mastering Java: The Ultimate Quiz for 'Thinking in Java'

Disable ads (and more) with a membership for a one time $2.99 payment

Mastering Java: The Ultimate Quiz for 'Thinking in Java'. Dive deep into Java with multiple-choice questions. Challenge yourself with quiz questions designed to test and improve your understanding of the 'Thinking in Java' book. Get ready for your exam!

Practice this question and more.


Which of the following is not a correct way to initialize an object?

  1. Using constructor with parameters

  2. By assigning values directly to fields

  3. By using object initializer blocks

  4. By calling a method on the object right after its declaration

The correct answer is: By calling a method on the object right after its declaration

The other options (A,B,C) are all valid ways to initialize an object. Option D is incorrect because it is not a way to initialize an object, rather it is a way to call a method on an already initialized object. This means that the object has already been created and cannot be initialized again.