Question: Given the following classes and declarations, which statements are true? Select the three correct answers. (a) The Bar class is a subclass of Foo. (b)
Given the following classes and declarations, which statements are true?

Select the three correct answers.
(a) The Bar class is a subclass of Foo.
(b) The statement b.f(); is legal.
(c) The statement a.j = 5; is legal.
(d) The statement a.g(); is legal.
(e) The statement b.i = 3; is legal.
// Classes class Foo { } private int i; public void f() { /* public void g() { /* class Bar extends Foo { public int j; public void g() { /* } // Declarations: Foo a new Bar (); Bar b= new Bar ();
Step by Step Solution
3.41 Rating (170 Votes )
There are 3 Steps involved in it
a b and d Bar is a subclass of Foo that overrides the meth... View full answer
Get step-by-step solutions from verified subject matter experts
