in Others edited by
319 views
0 votes
0 votes

What keyboard in class specification helps to hide data:

  1. Public
  2. Private
  3. Static
  4. Void
in Others edited by
319 views

1 Answer

0 votes
0 votes

Option B PRIVATE

Methods, variables, and constructors that are declared private can only be accessed within the declared class itself.

Private access modifier is the most restrictive access level. Class and interfaces cannot be private.

Variables that are declared private can be accessed outside the class, if public getter methods are present in the class.

Using the private modifier is the main way that an object encapsulates itself and hides data from the outside world.

Related questions