Java OCA OCP Practice Question 203

Question

Suppose foo is a reference to an instance of a class.

Which of the following is not true about foo.bar?

  • A. bar is an instance variable.
  • B. bar is a local variable.
  • C. It can be used to read from bar.
  • D. It can be used to write to bar.


B.

Note

Dot notation is used for both reading and writing instance variables, assuming they are in scope.

It cannot be used for referencing local variables, making Option B the correct answer.




PreviousNext

Related