tag:blogger.com,1999:blog-8712770457197348465.post8991404918465133057..comments2024-03-17T23:01:26.872-07:00Comments on Javarevisited: What is Abstraction in Java? Abstract Class and Interface Examplejavin paulhttp://www.blogger.com/profile/15028902221295732276noreply@blogger.comBlogger52125tag:blogger.com,1999:blog-8712770457197348465.post-39165367649943218642020-04-05T02:06:21.838-07:002020-04-05T02:06:21.838-07:00Hello Piyush, I don't know for sure but Alan K...Hello Piyush, I don't know for sure but Alan Kay is often credited with the invention of object oriented programming and Abstraction is a key OOP concept so he may be the first person to come with the idea of Abstract class and interface. javin paulhttps://www.blogger.com/profile/15028902221295732276noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-43594330274319237402020-04-04T01:33:03.418-07:002020-04-04T01:33:03.418-07:00Hey Javin, While abstract classes and interface ar...Hey Javin, While abstract classes and interface are used so frequently and heavily in all programming languages, I was wondering who was that brilliant mind that invented the concept of abstract classes. Even after searching for who invented abstract class and history of abstract class, I cannot find any page which lists how abstract classes came into existence. It would be great to know how theyPiyush @ abstract class and interfacehttps://askanydifference.com/difference-between-abstract-class-and-interface-in-c/noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-25405258649263903062017-11-05T23:20:32.627-08:002017-11-05T23:20:32.627-08:00Can anyone please provide a real time example how ...Can anyone please provide a real time example how you used Abstract class and Interfaces in your project, which actually gives the real knowledge of Abstraction.<br /> All the bookish definitions like Vehicle - Car all these will give the theoritical knowledge but not the practical knowledge.Yakoobnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-40426519810783408642017-11-05T23:14:50.964-08:002017-11-05T23:14:50.964-08:00Can anyone explain the real time scenario how you&...Can anyone explain the real time scenario how you've used Interface and Abstract class in your project.<br />Please don't give bookish examples or real world examples like Vehicle-Car relationship.Yakoobnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-70535822701497229952017-05-02T05:01:53.600-07:002017-05-02T05:01:53.600-07:00@Anonymous, good catch, thank you, fixed now.@Anonymous, good catch, thank you, fixed now.javin paulhttps://www.blogger.com/profile/15028902221295732276noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-46082510039504299192017-05-02T03:02:11.929-07:002017-05-02T03:02:11.929-07:00Please fix the Labels (i.e. from "Labels: cor...Please fix the Labels (i.e. from "Labels: core java; object oriented programming" to "Labels: core java, object oriented programming") of this page.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-63757623312109694422015-12-28T06:15:37.536-08:002015-12-28T06:15:37.536-08:00Hello Everyone,
Just to know the simple meaning o...Hello Everyone,<br /><br />Just to know the simple meaning of abstraction I would like to share one thing that would be I guess simple to understand for all of us.<br />As we all know the meaning of abstraction i.e Hiding the complexity and showing the functionality.<br />Like in other way we could say that hiding the unnecessary details from the user and only provide the details that will be Anonymoushttps://www.blogger.com/profile/06076959669777311042noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-46821718531352435402015-10-18T03:16:36.593-07:002015-10-18T03:16:36.593-07:00@Chandan, one example of Abstraction is instead of...@Chandan, one example of Abstraction is instead of reading from a file you read from a Reader or InputStream, by doing that you can create classes like java.util.Stream which can create a Stream out of a Reader and that's what lines() method does in Java 8. Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-10573190804738666492015-08-19T04:07:52.126-07:002015-08-19T04:07:52.126-07:00Please explain how we can achieve abstraction usin...Please explain how we can achieve abstraction using example.<br />And please demonstrate how we are abstracting(showing limited but hiding something ) .<br />And what problem we will get if we wont use abstraction. <br /><b>Please give some example </b>Chandan Kumarhttps://www.blogger.com/profile/04836128973182639695noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-60356872009045405462015-06-02T03:45:31.832-07:002015-06-02T03:45:31.832-07:00Hello All,
Abstraction concept in OOP means hidin...Hello All,<br /><br />Abstraction concept in OOP means hiding complicity. someone give example of Queue data structure or other complex logic which you want's to hide from developer and make his/ her life easy.<br /><br />From my perspective abstract class / interface in Java and Abstraction concept in OOPs both are not same.<br /><br />Abstraction concept says that hide complexity but Java&#Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-47153463270679723412015-05-19T02:56:32.755-07:002015-05-19T02:56:32.755-07:00@Anonymous, new ActionListener(){ ...} is an examp...@Anonymous, new ActionListener(){ ...} is an example of anonymous class, which is actually a concrete subclass of interface ActionListener, as it implmeents the only abstract method actionPerformed() defined in ActionListener interface. This was a quick way to implement interface or abstract class with single abstract method prior to Java 8, from JDK 8 onwards you can use Lambda expression to Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-13761570872133435382015-05-19T02:53:39.945-07:002015-05-19T02:53:39.945-07:00@Toddler, Yes you can override concrete method of ...@Toddler, Yes you can override concrete method of abstract class in its concrete or abstract subclass, provided super class method is not private, static or final as they can't be overridden. Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-44697628905044310502015-04-09T06:19:16.217-07:002015-04-09T06:19:16.217-07:00Can we override concrete methods of abstract class...Can we override concrete methods of abstract class in it's concrete subclass ot abstract subclass?TJainhttps://www.blogger.com/profile/06927287595198318546noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-20270048586788731712015-03-29T22:20:08.040-07:002015-03-29T22:20:08.040-07:00When you have written, that "you can not crea...When you have written, that "you can not create instance of abstract class"<br /> why there is "new ActionListener()" which is interface based on http://docs.oracle.com/javase/7/docs/api/java/awt/event/ActionListener.htmlAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-39957457140699943102015-01-21T19:22:16.337-08:002015-01-21T19:22:16.337-08:00@Liam, abstraction is really nice way to make your...@Liam, abstraction is really nice way to make your programming simpler. It allows you to deal with things which doesn't exists in reality but they are simpler to deal with. A good example of abstration is Queue data structure, which allows two process to share data e.g. in producer consumer problem. This queue can be impelmented using sockets, pipes, or shared memory, but your program don'Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-15414393617017522892015-01-10T00:40:40.032-08:002015-01-10T00:40:40.032-08:00Using Abstract allows you to force someone to impl...Using Abstract allows you to force someone to implement something.<br /><br />So something like this would work:<br /><br />Public void eat () {<br />putInMouth ();<br />eatIt ();<br />swallow ();<br />}<br /><br />Public abstract void putInMouth ();<br />Public abstract void eatIt ();<br />Public abstract void swallow ();<br /><br />You would not be able to extend without implementing those 3, Stephen Brownnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-32974756112222640222015-01-10T00:40:04.776-08:002015-01-10T00:40:04.776-08:00To be honest I never understood abstract. (I'm...To be honest I never understood abstract. (I'm in high school) I mean, why not just make a concrete one and simply not implement it? That way if for some reason you had to implement it you could, and if you don't, no harm done. Can I get an explanation?Liam Raineynoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-85320043411847376082014-12-21T22:17:45.198-08:002014-12-21T22:17:45.198-08:00What is use of constructor in Abstract class ?...What is use of constructor in Abstract class ?Anonymoushttps://www.blogger.com/profile/13318879221505910860noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-16204316503666153522014-02-27T04:38:48.496-08:002014-02-27T04:38:48.496-08:00hey your blogs is what is abstraction but u r not ...hey your blogs is what is abstraction but u r not mentioned meaning of abstractions<br /> Anonymoushttps://www.blogger.com/profile/16230455274959472628noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-64003672897186100272013-05-24T00:01:06.892-07:002013-05-24T00:01:06.892-07:00If you are defining a abstract method then you hav...If you are defining a abstract method then you have to declare a class type abstract explicitly. otherwise it will give compiler error.Krishna....https://www.blogger.com/profile/02295016084039218505noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-62651920006463952372013-05-08T05:15:43.980-07:002013-05-08T05:15:43.980-07:00@Rahul, Thanks, That's great suggestion. I am ...@Rahul, Thanks, That's great suggestion. I am writing about when to use abstract class and interface in Java, keep in touch or subscribe RSS feed to know about it. Javin @ abstract class interface interview questionshttp://javarevisited.blogspot.com/2013/04/10-abstract-class-and-interface-interview-question-java-answers.htmlnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-16744559379053740642013-05-08T03:41:43.463-07:002013-05-08T03:41:43.463-07:00Really nice post(and comments as well) about Abstr...Really nice post(and comments as well) about Abstraction in Java. Would like to know when to use abstract class and when to use interface?Rahul Askarhttps://www.blogger.com/profile/10523230965873417240noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-67406220687549173462013-04-04T03:21:42.810-07:002013-04-04T03:21:42.810-07:00in Summary
from point number 4
"a class autom...in Summary<br />from point number 4<br />"a class automatically becomes abstract class when any of its method declared as abstract"<br /><br />This point is actually incorrect as you need to make class explicitly and compiler will give error if you don't do so<br /><br />Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-44854785978557414252013-03-18T07:23:08.828-07:002013-03-18T07:23:08.828-07:00Abstraction: showing functionality hiding the impl...Abstraction: showing functionality hiding the implementation which is abtsract, abstraction is showing functionality irrelevent to its implementation in which whose implementation can change overtime with different type of instances but purpose is retained. doing this complexity of its implementation is hidden.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-7821165141768771772013-03-07T00:42:51.988-08:002013-03-07T00:42:51.988-08:00How about level of Abstraction? level of abstracti...How about level of Abstraction? level of abstraction is very important while declaring, classes, interface and methods. Interface should have higher level of abstraction than methods.Anonymousnoreply@blogger.com