Encapsulation is hiding of data and implementation by outside world using access specifier but Abstraction is contract and hiding of Implementation by using Interface and abstract keywords. Abstraction helps in Design level but Encapsulation helps in class level. These are advanced concepts.
supposed we have one baseClass in that have two method first method access modifier is public and second method access modifier is private. second private method call inside the first method. Now we are inherit baseClass to derived class ok. now in this situation calling method inside the class called abstraction and we are hiding this method from derived class called encapsulation.
AbstractionAbstraction allows us to represent complex real world in simplest manner. It is process of identifying the relevant qualities and behaviors an object should possess, in other word represent the necessary feature without representing the back ground details. Abstraction is a process of hiding work style of an object and showing only those information which are required to understand the object. Abstraction means putting all the variables and methods in a class which are necessary.EncapsulationIt is a process of hiding all the internal details of an object from the outside real world. The word Encapsulation, like Enclosing into the capsule. It restrict client from seeing its internal view where behavior of the abstraction is implemented. In Encapsulation, generally to hide data making it private and expose public property to access those data from outer world. Encapsulation is a method for protecting data from unwanted access or alteration. Encapsulation is the mechanism by which Abstraction is implemented.
Abstraction is concept. And encapsulation is hiding implementation of concept. We can take example of refrigerator Freezing is concept user Knows only cooling (Abstraction). How it is done user need not to know(Encapsulation). Only showing what is necessary is Abstraction and hiding complexity is encapsulation.
Data abstraction is proving only data which are needed and Encapsulation is protecting data from the outside interference
abstraction solve design level problem. Encapsulation solve implementation level problem.
abstraction emplies with the help of access modifier. private method not accessible but public methods can accessible is ABTRACTIOnencapsulation is we use any method without knowing its functionality is known as encapsulation.
Abstraction means to abstract something and encapsulation means to hide something. As the name implies the abstraction provides only abstract or brief and important summary while encapsulation hides the implementation details. The abstraction is implemented with interface and abstract class while the encapsulation are implemented with the private and public modifier.
encapsulation means wrapping of data inside the class and abstraction means hiding of data means background process suppose when we write console.write behind that more line of coding after that we use single line coding it means abstractions