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 Java Objects (Retired) Delivering the MVP Wrapping Up

Slava Fleer
Slava Fleer
6,086 Points

hello. could you rephrase the first exercise, please? I didn't understand what i need to finish it. thanks.

hello. could you rephrase the first exercise, please? I didn't understand what i need to finish it. thanks.

Slava Fleer
Slava Fleer
6,086 Points

hello. could you rephrase the first exercise, please in Android Development->Stage 4 Delivering the MVP -> Wrapping UP ? I didn't understand what i need to finish it. thanks.

5 Answers

Nikolay Egov
Nikolay Egov
96 Points

A constructor is a method with the same name as the class and return nothing. So what you have written is just a normal method. If the class is Forum them the constructor should be something like: public Forum (String someString) { //code goes here mTopic = someString; }

Ben Morse
Ben Morse
6,068 Points

This works. Thanks!

Ivan Sued
Ivan Sued
5,969 Points

What the task is asking you is to create a constructor that takes a string as a parameter in the forum class aka. Forum.java. It is the third file from the left.

The Constructors are the initial method that is called when a instance is created. The have the same name as the class.

Hope that helps

Slava Fleer
Slava Fleer
6,086 Points

thanks. i would check it later.

Slava Fleer
Slava Fleer
6,086 Points

still didn't get it =(

what i added is :

public void addTopic(String topic){ mTopic = topic; }

and i received next error:

Bummer! Did you add a new constructor that takes accepts a string?

any help ?

Ivan Sued
Ivan Sued
5,969 Points

Make sure to name the constructors as I mentioned on my original answer and how Nikolay mentioned. Constructors have the same name as the class and return nothing.

Juan Santiago
Juan Santiago
3,766 Points

I had the same problem, I don't know why exactly but the only thing that fixed it was removing the "void" part. Like:

public Forum (String theTopic) { mTopic=theTopic; }

Neelesh Tewani
Neelesh Tewani
1,239 Points

hi i am neelesh i want to know how to do the fouth task in this challenge