tag:blogger.com,1999:blog-8712770457197348465.post498897833725927257..comments2024-03-29T05:54:46.190-07:00Comments on Javarevisited: Difference between Inheritance and Composition in Java and Object Oriented Programmingjavin paulhttp://www.blogger.com/profile/15028902221295732276noreply@blogger.comBlogger12125tag:blogger.com,1999:blog-8712770457197348465.post-70025911327973053542020-01-31T04:53:17.546-08:002020-01-31T04:53:17.546-08:00You can definitely mock using Mockito. You can definitely mock using Mockito. javin paulhttps://www.blogger.com/profile/15028902221295732276noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-30528995054836582512020-01-30T21:52:35.242-08:002020-01-30T21:52:35.242-08:00Great article. I find every point in your articles...Great article. I find every point in your articles worth noting. I have never written unit tests myself. I have a little knowledge about it. So I have a doubt here: why can't we mock a parent class? if class B extends A why can't we create a mock of A like we mock any class using Mockito?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-55306396133235138192019-07-11T18:41:35.249-07:002019-07-11T18:41:35.249-07:00This is a better example of UML diagram:
Inheritan...This is a better example of UML diagram:<br />Inheritance = A cat is an animal. Composition = A car has an engine.Anonymoushttps://www.blogger.com/profile/02960505684526437180noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-85423339578562150652019-05-06T12:19:40.494-07:002019-05-06T12:19:40.494-07:00Nicely explainedNicely explainedAnonymoushttps://www.blogger.com/profile/08124176172783820644noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-8606831763356532932019-02-02T08:50:29.360-08:002019-02-02T08:50:29.360-08:00wow please correct this, the diagram is wrongwow please correct this, the diagram is wrongAnonymoushttps://www.blogger.com/profile/12547058559838464540noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-10552748410043768122018-11-25T11:50:00.905-08:002018-11-25T11:50:00.905-08:00The UML diagram is incorrect for composition relat...The UML diagram is incorrect for composition relationship and inheritance.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-23145072724375103562017-05-04T16:52:49.074-07:002017-05-04T16:52:49.074-07:00Thank you @Dinesh, glad that you like this article...Thank you @Dinesh, glad that you like this article. if you have any question/doubt, feel free to ask. javin paulhttps://www.blogger.com/profile/15028902221295732276noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-71219865320268894372017-05-04T10:10:34.031-07:002017-05-04T10:10:34.031-07:00Excellent help on understanding. ThanksExcellent help on understanding. ThanksDinesh Guptahttps://www.blogger.com/profile/15021463465935797174noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-37656584135127237332017-03-27T02:51:30.980-07:002017-03-27T02:51:30.980-07:00Nice Nice Anonymoushttps://www.blogger.com/profile/10116055307088376845noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-63765822110780565312016-08-21T09:52:13.199-07:002016-08-21T09:52:13.199-07:00Awesome article. Awesome article. Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-47588273896531751342016-03-25T16:25:55.204-07:002016-03-25T16:25:55.204-07:00House is a Building. The UML diagram is incorrectHouse is a Building. The UML diagram is incorrectAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-19036385373744202202015-06-02T23:15:11.113-07:002015-06-02T23:15:11.113-07:00I have also read Effective Java and from that I ca...I have also read Effective Java and from that I can say that Composition is better than Inheritance but Inheritance is equally good for defining type hierarchy, so you cannot undermine importance of Inheritance. Anonymousnoreply@blogger.com