What is encapsulation? How can it be enforced in Java?

What will be an ideal response?

Encapsulation is the principle that objects should be self-governing. In other words, an object's internal data
should be protected from outside access. Encapsulation can be enforced in Java by making instance variables private.

Computer Science & Information Technology

You might also like to view...

A ________ file is one in which all values are separated by commas

A) CSV B) XLSX C) DOCX D) TXT

Computer Science & Information Technology

A method that calls itself is a __________________ method.

a) invalid b) static c) final d) recursive e) public

Computer Science & Information Technology