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 trialWilliam Steele
1,739 PointsJava objects final editor: the forum.
I'm on the last part and not quite sure what it's asking to make it work, when I just run a blank test with what's already written, pops up several errors. I was thinking it might need user input, but my implementation has caused further errors. So I'm currently stuck trying to figure out what step it is I should do.
2 Answers
Kyle McCullen
16,639 PointsAfter uncommenting the code it wants you to add parameters to the constructors. We added parameters to the User constructor to take a first and last name, which are provided by the args parameter (we know this from the comments). We also added parameters to our ForumPost constructor, a User object a title and description so we must add them to the instantiation of our post object.
//Uncomment this when prompted
Forum forum = new Forum("Java");
// TODO: pass in the first name and last name that are in the args parameter
User author = new User(args[0], args[1]);
// TODO: initialize the forum post with the user created above and a title and description of your choice
ForumPost post = new ForumPost(author, "Title here", "Description Here");
forum.addPost(post);
William Steele
1,739 PointsForum forum = new Forum("Java"); constructor Forum in class Forum cannot be applied to given types
The rest is title, description, and .get errors, which I can solve, this one has been bugging me out
Yusuf Mohamed
2,631 PointsYusuf Mohamed
2,631 PointsWhy is there "" around the title and the description
ForumPost post = new ForumPost(author, "Title here", "Description Here");
Kyle McCullen
16,639 PointsKyle McCullen
16,639 PointsDouble quotes denote a string.
Yusuf Mohamed
2,631 PointsYusuf Mohamed
2,631 PointsYes, I understood that it's a string but in this case shouldn't the title and description be dynamic or is the strings that we have written only some little text for where we are writing the actual forum post?