Encapsulation in Java
The whole idea behind encapsulation is to hide
the implementation details from users. If a data member is private it means it
can only be accessed within the same class. No outside class can access private
data member (variable) of other class. That’s why encapsulation is known as data hiding.
Abstracton in
java
Abstraction is the quality of dealing with ideas rather than events. For
example, when you consider the case of e-mail, complex details such as what
happens as soon as you send an e-mail, the protocol your e-mail server uses are
hidden from the user. Therefore, to send an e-mail you just need to type the
content, mention the address of the receiver, and click send.
Comments
Post a Comment