tag:blogger.com,1999:blog-694855878384792308.post3966750215985596796..comments2024-03-15T23:19:22.318-07:00Comments on Java67: Difference between Abstraction and Encapsulation in Java and Object Oriented Programming? [Answer]javin paulhttp://www.blogger.com/profile/15028902221295732276noreply@blogger.comBlogger21125tag:blogger.com,1999:blog-694855878384792308.post-18025007943863739862018-09-25T04:14:50.997-07:002018-09-25T04:14:50.997-07:00hello Ravi, very interesting observation. Yes, I w...hello Ravi, very interesting observation. Yes, I would rather say, Abstraction simplifies design and Encapsulation hides implementation.javin paulhttps://www.blogger.com/profile/15028902221295732276noreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-5191807967982193372018-09-03T13:52:37.857-07:002018-09-03T13:52:37.857-07:00I'm not agree with your explanation, actually ...I'm not agree with your explanation, actually abstraction is a hypothesis which expose the behaviour and hide all the complex implementation and encapsulation is a practicality to hide or encapsulate the chunk of data and functionality within a class/capsule to hide the complex implementation. So the main difference is Abstaraction is a hypothetical process and encapsulation is a practical process to hide user non relevant complex implementation.Anonymoushttps://www.blogger.com/profile/09122395649023063778noreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-57966720745765233812017-06-26T04:31:08.578-07:002017-06-26T04:31:08.578-07:00great explaination anoop thanksgreat explaination anoop thanksAnonymoushttps://www.blogger.com/profile/05723339342870716600noreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-19684656815250061342017-02-07T21:21:19.073-08:002017-02-07T21:21:19.073-08:00"Encapsulation is implemented using private k..."Encapsulation is implemented using private keyword and other access modifier."<br /><br />Above statement is wrong.<br /><br /><br />Encapsulation achieve by encapsulating the data and functionality in the same place , either it on the class or in the same method. it is not related to the access modifiers. <br />Avnish Kumar Singhhttps://www.blogger.com/profile/00606688753260410776noreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-66690217230053218492017-01-12T08:06:49.259-08:002017-01-12T08:06:49.259-08:00You just rock manYou just rock manAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-5742038648358510962016-09-26T20:55:12.113-07:002016-09-26T20:55:12.113-07:00Abstraction is hiding the information or providing...Abstraction is hiding the information or providing only necessary details to the client.<br /><br />e.g Car Brakes- You just know that pressing the pedals will stop the vehicle but you dont need to know how it works internally.<br /><br />Advantage of Abstraction Tomorrow if brake implementaion changes from drum brake to disk brake, as a client, you dont need to change(i.e your code will not change)<br /><br />Encpasulation is binding the data and bahaviours together in a single unit. Also it is a language mechanism for restricting access to some components(this can be achived by access modifiers like private,protected etc.)<br /><br />For e.g. Class has attributes(i.e data) and bahaviours (i.e methods that operate on that data)Anoop Vashisthahttps://www.blogger.com/profile/03674997975992344743noreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-61828119147911359242016-02-22T22:10:50.597-08:002016-02-22T22:10:50.597-08:00This is correct. Encapsulation is actually a kind ...This is correct. Encapsulation is actually a kind of abstraction only.Anonymoushttps://www.blogger.com/profile/08525017885186371939noreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-26611677154456628052015-12-12T08:08:43.465-08:002015-12-12T08:08:43.465-08:00Very good questions . Here are some 30 Java OOP co...Very good questions . Here are some <a href="http://java67.blogspot.com/2015/12/top-30-oops-concept-interview-questions-answers-java.html" rel="nofollow">30 Java OOP concept interview questions</a>, I have found immensely useful. ThanksAnonymoushttps://www.blogger.com/profile/14711740575876145166noreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-67540406393588703772015-10-24T08:29:42.857-07:002015-10-24T08:29:42.857-07:00Good Example of encapsulation is POJOGood Example of encapsulation is POJOAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-41306879398958836552014-12-11T20:41:48.256-08:002014-12-11T20:41:48.256-08:00Abstraction is a way to talk in general terms, ins...Abstraction is a way to talk in general terms, instead of talking about playing cricket, you talk about playing. Instead of talking nitty gritty about how to sort an array using quicksort, you just talk about sorting. The higher the level of abstraction, the more general it becomes. This is why right level of abstraction is needed between components. It become increasingly important while inter acting between components. This is where abstract class and interface comes into picture, they are Java's tool to assist a program with abstraction. interface is generally more abstract then their implementaiton and that's why if two component talk with interface, they are easy to change and extend. <br /><br />On the other hand encapsulation is about hiding internal details? Why? because it allows you to change the internals of an object without affecting extenal client. If an outside object knows how a car run, you cannot change it but if it just know that it runs but not how, you can improve how it runs. Java provides sevral access modifier e.g. public, private, protected and package to keep encapsulation in check. Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-78905380187893562172014-09-01T06:40:50.778-07:002014-09-01T06:40:50.778-07:00Abstraction means that you've just named the b...Abstraction means that you've just named the behaviors and outline of your class, and implementations are there to be written somewhere else in detail (not mattering using which way/strategy)<br /><br />Encapsulation means that you implement your whole class (not mattering whether you've made an abstract before or not) and you put some restrictions in this very class so that no one can access it or change it directly.Anonymoushttps://www.blogger.com/profile/02873310685866454298noreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-33524117979066056922013-08-19T04:13:11.782-07:002013-08-19T04:13:11.782-07:00encapsulation is not a mechanism but a principle o...encapsulation is not a mechanism but a principle or conecpt like abstractionAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-16325679546286314322013-08-13T08:18:01.431-07:002013-08-13T08:18:01.431-07:00but how they are complementary to each other????but how they are complementary to each other????Anonymoushttps://www.blogger.com/profile/14904764506967928958noreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-1555997551468641842013-08-06T12:07:14.161-07:002013-08-06T12:07:14.161-07:00well said sir...well said sir...Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-8916345257872510592013-06-22T19:43:30.350-07:002013-06-22T19:43:30.350-07:00I think following link
http://lavraham.com/node/2...I think following link <br />http://lavraham.com/node/21 defines what pradip says more clearly.vikashttps://www.blogger.com/profile/15841945865444901417noreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-3122205778109004002013-06-09T06:21:27.985-07:002013-06-09T06:21:27.985-07:00Well Abstraction is the concept and encapsulation ...Well Abstraction is the concept and encapsulation is mechanism to fulfil that concept :)giving uphttps://www.blogger.com/profile/06544924585313195760noreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-53872481040925938022013-03-18T07:55:06.598-07:002013-03-18T07:55:06.598-07:00Well Abstraction and encapsulation are both viewin...Well Abstraction and encapsulation are both viewing same thing in java with different point. here abstarction means showing functionality hiding information i.e complexity and in encapsulation u do same thing u wrap up things within a class which will encapsulates. wat i can say is abstraction is evalved from encapsulation by its implementation and abstraction by its use. i.e encapsulation is part of abstraction. Ex: creating a class is encapsulation and way of implementation i.e by using intereface and abstract classes is abstraction. cvahttps://www.blogger.com/profile/09327154668534113814noreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-39901216425141847802013-03-11T10:49:55.836-07:002013-03-11T10:49:55.836-07:00examples explaining both concepts would be helpful...examples explaining both concepts would be helpful.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-32608503564564860702013-03-01T21:31:50.688-08:002013-03-01T21:31:50.688-08:00need more clear concept about abstraction...need more clear concept about abstraction...Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-28233745929916114812012-12-20T23:56:29.825-08:002012-12-20T23:56:29.825-08:00How come definition is same, Its clearly saying th...How come definition is same, Its clearly saying that abstraction is implemented using interface and abstract class and Encapsulation is implemented using private keyword and other access modifier.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-694855878384792308.post-7356883330642694342012-10-01T13:07:54.161-07:002012-10-01T13:07:54.161-07:00This is nonsense. Your definition of abstraction a...This is nonsense. Your definition of abstraction and encapsulation are the same.Anonymousnoreply@blogger.com