InheritanceStructure 1

InheritanceStructure 1 - below it and so on So for what is...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
public class First { public void method20 { System. out. pri ntl n (" Fi rst2" ) ; J public void method30 method2O; ) ) public class Second extends First { public void method2O { System. out. pri ntl n("Second 2 " ) ; j ) public class Third extends Second { public void methodlO { System.out. printl n("Thi rd 1 ") ; super.method2O; ) public void method20 { System. out. pri ntl n("Third2") ; ) ) public class Fourth extends First { public void methodl0 { System. out. pri ntl n("Fou rth 1 ") ; ) public void method2Q { System.out. println("Fourth2") ; ) ) Given the previous, draw
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: below it and so on. So for what is on the left, you have. .. Then you build a table of methods from the top of the tree on down. tf you call "super.<somemethod>0", then look at the inheritance tree for the super ctass and copy whatever it's <somemethod>O does into your cell of the table. lf your cell says <method>fl (note the lack of super.), then just write "<method>0" in the cell so if it's inherited, you do the correct thing. Fourth Remember that when executing a method for ObjectType, execute only the methods of ObjectType. For example, if the ObjectType Third, then a call to its method30 will call Third's method3. Class First Second...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online