What is encapsulation?

Encapsulation is restricting data and actions to object they are defined in. In other words, no other object can access and modify them directly. In Java encapsulation can be achieved by making an object or specific variable "private" instead of "public" (keep in mind that main method must be public). You can think of it as a literal capsule. You close data in such capsule so it is safe and you cannot really see or modify it from outside the capsule.

SJ

Related Computing IB answers

All answers ▸

What is a network protocol and why do we need it?


Add the binary numbers 100101 and 101001 and convert them to decimal (they are unsigned integers). What are possible issues when adding the numbers?


Explain the difference between the cache memory and the buffer.


What are adventages and disadventages of encryption network security?