Computer Applications

Which of the following statements is the most appropriate for the private members?

  1. They are visible out of the class in which they are defined.
  2. They can be used in the sub-classes.
  3. They are only visible in the class in which they are declared.
  4. None of the above.

Java Classes

29 Likes

Answer

They are only visible in the class in which they are declared.

Reason — Private data members and member methods can only be used within the scope of a class.

Answered By

10 Likes


Related Questions