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 keyword makes a class member available to everyone?

  1. private

  2. protected

  3. public

  4. package

The correct answer is: public

The correct keyword to make a class member accessible to everyone is "public". Private variables can only be accessed within the same class, while protected variables can only be accessed within the same package or through inheritance. The keyword "package" is not used to define accessibility but instead specifies the package in which the class is defined.