Question: package q09; public class Main { public static void main(String[] args) { //implement the necessary abstract class hierarchy //NOTE: Star does not extend any of

package q09; public class Main { public static void main(String[] args) { //implement the necessary abstract class hierarchy //NOTE: Star does not extend any of the other classes, only Object /*output supposed to be like below in comments// */ // Bar::go // Car::go // Star::go // Bar::go // Bar::go // Bar::go // Car::go // Star::go Foo a = new Bar(); Foo b = new Car(); Foo c = new Star(); AbstractFoo d = new Bar(); AbstractFoo e = new Bar(); Bar f = new Bar(); Bar g = new Car(); Star h = new Star(); a.go(); b.go(); c.go(); d.go(); e.go(); f.go(); g.go(); h.go(); } } interface Foo { void go(); } package q10; public class Main { public static void main(String[] args) { //implement the necessary abstract class hierarchy /*output supposed to be like below in comments// */ // Bar::go // Bar::away // Car::go // Car::away // Bar::go // Bar::away // Car::go // Car::away // Car::go // Car::away AbstractFoo a = new Bar(); AbstractFoo b = new Car(); Bar c = new Bar(); Bar d = new Car(); Car e = new Car(); a.go(); a.away(); b.go(); b.away(); c.go(); c.away(); d.go(); d.away(); e.go(); e.away(); } } interface Foo { void go(); } package q11; public class Main { public static void main(String[] args) { //implement the necessary abstract class hierarchy //NOTE: Bar class is unimplemented, meaning its body is empty. /*output supposed to be like below in comments// */ // AbstractFoo::go // AbstractFoo::away // AbstractFoo::away // Car::go // Car::away // AbstractFoo::go // AbstractFoo::away // AbstractFoo::away // Car::go // Car::away // Car::go // Car::away AbstractFoo a = new Bar(); AbstractFoo b = new Car(); Bar c = new Bar(); Bar d = new Car(); Car e = new Car(); a.go(); a.away(); b.go(); b.away(); c.go(); c.away(); d.go(); d.away(); e.go(); e.away(); } } interface Foo { void go(); }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!