I suggest you ...

Question with a error.

In the following question, line 18, there is an error:

- this.wingCount = 0. wingCount don't inherited by Animal class, because it's a private member in Creature. So there will a compilation error.

1. What do you need to do to correct compilation errors? (Select two)
2. public class Creature {
3. private int legCount;
4. private int wingCount;
5.
6. public Creature(int legCount) {
7. this.legCount = this.legCount;
8. this.wingCount = 0;
9. }
10.
11. public String toString() {
12. return "legs=" + this.legCount + " wings=" + wingCount;
13. }
14. }
15.
16. public class Animal extends Creature {
17. public Animal(int legCount) {
18. this.wingCount = 0;
19. }
20.
21. }

1 vote
Vote
Sign in
(thinking…)
Sign in with: facebook google
Signed in as (Sign out)
You have left! (?) (thinking…)
Anonymous shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

0 comments

Sign in
(thinking…)
Sign in with: facebook google
Signed in as (Sign out)
Submitting...

Feedback and Knowledge Base