tag:blogger.com,1999:blog-8712770457197348465.post3512278215503434527..comments2024-03-17T23:01:26.872-07:00Comments on Javarevisited: What is Inheritance in Java and OOP Tutorial - Examplejavin paulhttp://www.blogger.com/profile/15028902221295732276noreply@blogger.comBlogger6125tag:blogger.com,1999:blog-8712770457197348465.post-81912053266857804852015-01-15T00:12:42.268-08:002015-01-15T00:12:42.268-08:00In your example there is kind of a mistake.
"...In your example there is kind of a mistake. <br />"//we need to cast to get actual Server instance back in reference variable."<br />that's not true because all methods in java are virtual. So even without casting to Tomcat it will call start and stop by the Tomcat instance. <br /><br />Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-50731344156245486562014-09-03T19:36:07.933-07:002014-09-03T19:36:07.933-07:00Java does support multiple inheritance, what it no...Java does support multiple inheritance, what it not support is multiple inheritance of state (which is bad). Java support multiple inheritance of type using interface and it's there from the beginning. From Java 8 onwards, Java has also started supporting multiple inheritance of behavior using default methods. So now, the question of whether Java supports multiple inheritance or not has Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-81048197075312599592014-08-26T03:08:21.366-07:002014-08-26T03:08:21.366-07:00Inheritance should not be used just for code reuse...Inheritance should not be used just for code reuse purpose, there are better ways to do that e.g. composition and delegation. Instead, you should only use Inheritance when substitution is possible. In another word Derived class take stand in place of Base class, this is also known as liskov subtituion principle. If you use Inhritance just for code reuse and your class voilate Liskov subtituion Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-48282082544465320372014-08-22T07:29:30.561-07:002014-08-22T07:29:30.561-07:00But multiple inheritance still supports with Inter...But multiple inheritance still supports with Interfaces.<br /><br /><br />http://codeinventions.blogspot.in/2014/07/can-interface-extend-multiple.htmlAnonymoushttps://www.blogger.com/profile/02687373963458131573noreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-38537177356294283792012-12-18T03:01:40.737-08:002012-12-18T03:01:40.737-08:00Thanks for the great post! I also did not know th...Thanks for the great post! I also did not know that Java does not support multiple inheritance like C++. This is a good reference which discusses that fact:<br /><br /><br />http://www.programmerinterview.com/index.php/java-questions/multiple-inheritance/<br />Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8712770457197348465.post-78199634928207554722012-10-09T08:03:20.821-07:002012-10-09T08:03:20.821-07:00Hi,
I have question regrading Hibernate "What...Hi,<br />I have question regrading Hibernate "What is n+1 problem and what is the best feasible solutions to over come this problem"?<br />can you please explain me and do the needful. thanks advance,Anonymoushttps://www.blogger.com/profile/06225370479216099810noreply@blogger.com