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

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

Want to excel in Java? Test your knowledge with our ultimate quiz based on 'Thinking in Java'. Engage with multiple-choice questions and in-depth explanations. Boost your understanding and prepare for your exam with confidence.

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.


Which method can NOT be called directly in Java?

  1. main()

  2. finalize()

  3. System.gc()

  4. private methods of the same class

The correct answer is: finalize()

Finalize() is the only option that cannot be called directly in Java. This is because finalize() is used by the garbage collector to free up memory resources and cannot be called explicitly in the code. All other methods, including main(), System.gc(), and private methods of the same class, can be called directly in Java.