Wrong Example given as shown below

classic Classic list List threaded Threaded
2 messages Options
Shobhit Saxena Shobhit Saxena
Reply | Threaded
Open this post in threaded view
|

Wrong Example given as shown below

http://www.buggybread.com/2014/04/200-java-j2ee-interview-questions-and.html
 Q82. What is difference between Encapsulation And Abstraction?show Answer

Ans. 1.Abstraction solves the problem at design level while encapsulation solves the problem at implementation level

2.Abstraction is used for hiding the unwanted data and giving relevant data. while Encapsulation means hiding the code and data into a single unit to protect the data from outside world.

3. Abstraction lets you focus on what the object does instead of how it does it while Encapsulation means hiding the internal details or mechanics of how an object does something.

4.For example: Outer Look of a Television, like it has a display screen and channel buttons to change channel it explains Abstraction but Inner Implementation detail of a Television how CRT and Display Screen are connect with each other using different circuits , it explains Encapsulation.
buggybread buggybread
Reply | Threaded
Open this post in threaded view
|

Re: Wrong Example given as shown below

Hi Shobhit,

First of all Sorry for not responding to your message earlier.

The Example doesn't seem to be wrong but the explanation could be. Here the Abstraction is the function to Change Channels. The Function "Changing the Channel" is just triggered with Pressing the Button but is actually an abstraction over multiple steps ( capture the signal, identify the next channel, display it on CRT ).

Moreover It encapsulates all those steps within itself and doesn't allow the user the access to individual steps and hence that's encapsulation.

I will try to rephrase the answer it with the next update so that it makes better sense.

Thanks,
Vivek
www.buggybread.com