Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java Inheritance in Java Inheritance in Java Object Override

Sebastian Nawrocki
PLUS
Sebastian Nawrocki
Courses Plus Student 2,057 Points

What code is missing to get through to Bird constructor (parent class)?

Hey all,

Please help me out with this quiz, idk if its me getting overwhelmed with amount of info Im trying to absorb about Java or I just cant get this one somehow...

class Bird { String name;

public Bird(String name) {
    this.name = name;
}

}

class Parakeet extends Bird { public Parakeet(String name) { NEED TO TYPE CODE HERE } }

I already tried some stuff like: super.Bird(); super.name; super("");

and few others... I'd appreciate the help as its really bugging me

1 Answer

Steven Parker
Steven Parker
231,184 Points

You nearly had it on that last try, where you were calling "super" as a function. But instead of an empty string, you need to pass along the argument that was passed in to "Parakeet".

Sebastian Nawrocki
Sebastian Nawrocki
Courses Plus Student 2,057 Points

Yes... super(name); was the correct answer. Still bit confused but the clouds of mind slowly start to clear out. Thank you for your time ! Hope this helps somebody else along their journey!