class - Extending multiple classes in java -


this question has answer here:

i have java class extends class. have found need inherit yet class , not sure how this. have tried class implements class b, class c. not work. class extends class b. need inherit class c. have tried create interface extends class c, says interface cannot extend class. not sure now..

you need c extends b extends a. or using interface u can multiple inheritance in java. jdk 1.8 defalut feature has been added multiple inheritance using interfaces.


using composition on inheritance

update : can use this

class seaplane implements vehicle {   private vehicle plane,                 ship;   @override   public void safetycheck() {    plane.safetycheck();    ship.safetycheck()    } } 

Comments

Popular posts from this blog

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

java - Log4j2 configuration not found when running standalone application builded by shade plugin -

python - How do I create a list index that loops through integers in another list -