Java OCA OCP Practice Question 1166

Question

Fill in the blank:

A ___ variable is always available to all instances of the class.

  • A. public
  • B. local
  • C. static
  • D. instance


C.

Note

The only variables always available to all instances of the class are those declared static;

Option C is the correct answer.

Option A may seem correct, but public variables are only available if a reference to the object is maintained among all instances.

Option B is incorrect because there is no local keyword in Java.

Option D is also incorrect because a private instance variable is only accessible within the instance that created it.




PreviousNext

Related