217k views
2 votes
given the classes above, what output is produced by the following code? meg[] elements ={new Lois(), new Stewie(), new Meg(), new Brian()}; for (int i = 0; i

1 Answer

2 votes

Answer:

Inheritance Mystery

Lois a Meg a

Lois b

Meg

Lois a Meg a Stewie a

Lois a Meg a Stewie a Brian b

Brian Stewie

Meg a

Meg b

Meg

Lois a Meg a

Lois a Meg a Brian b

Brian

User Ergin Ersoy
by
3.6k points