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

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

Dive into the depths of Java with our quiz based on "Thinking in Java, Fourth Edition" by Bruce Eckel. Test your knowledge, solidify concepts, and prepare for certification with challenging questions and insightful feedback.

Each practice test/flash card set has 50 randomly selected questions from a bank of over 500. You'll get a new set of questions each time!

Practice this question and more.


How is the address of an object printed using the 'this' keyword inside its toString() method?

  1. Directly using this.toString()

  2. Using super.toString()

  3. By converting 'this' to a string

  4. By utilizing System.out.toString(this)

The correct answer is: Using super.toString()

B is the correct answer because using the 'super' keyword allows us to access the toString() method of the parent class, which outputs the object's address. Additionally, options A and C are incorrect because they do not utilize the 'super' keyword. Option D is incorrect because System.out.toString() is not a valid method and cannot be used with the 'this' keyword.