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.


What is true about static methods?

  1. They can't use this

  2. They can access instance methods directly

  3. They are only used in static classes

  4. They cannot be private

The correct answer is: They can't use this

Static methods do not require an instance of the class to be called, hence they cannot use `this` keyword to reference the current instance. This means that they cannot access any instance methods or variables directly. Option C is incorrect because static methods can also be used in non-static classes. Option D is incorrect because static methods can be private as well.