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

"Override an inherited method" problem with adding in the quotes ""

This is the code I added. I have to escape the quotes so that with the title it will actually add the quotes like this: Blogpost: "My titleeeeeee" by Me.

@Override public String toString() { return "Blogpost: \"" + mTitle + "\"by " + mAuthor; }

But it gives this error: Bummer! Make sure you follow the instructions. Received 'Blogpost: "Check this out!"by Craig Dennis' does that match what was requested?

1 Answer

The challenge asks for: "BlogPost: TITLE by AUTHOR", i.e., TITLE should not be enclosed by quotes. Besides this you should also have a big P in Blogpost:

@Override 
public String toString() { 
    return "BlogPost: " + mTitle + " by " + mAuthor; 
}

Hmm! It did work! Strange error message though... Seems to imply it wants ""Check this out!"" in "". Anyways thanks for the answer!