0
What is class?
In class how can we hide the data. Abstract and encapsulation
1 Antwort
+ 2
[I am explaining Abstraction/Encapsulation based on my knowledge on C++/C# , I do not know if it may differ from Java]
Abstraction shows only the relevant/useful data to the user while Encapsulation hides irrelevant/useless data from the user.
Access specifiers like public, private, protected, etc are mostly used to do abstraction/encapsulation.
There is also a get-set method used, the get method is used to retrieve value from private field and the set method is used for storing value in private variables.