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?

// Classes class Foo { } private int i; public void f()

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

1 Expert Approved Answer
Step: 1 Unlock

a b and d Bar is a subclass of Foo that overrides the meth... View full answer

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 Java Programming 8th Questions!