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 trialNAJEEBULLAH KHAN
2,967 Pointsi dnt know why its asking me to make contructor while i have alreaaaaaady done so
why
package com.example;
import java.util.Date;
public class BlogPost {
private String mAuthor;
private String mTitle;
private String mBody;
private String mCategory;
private Date mCreationDate;
public BlogPost (String member, String author, String title, String body, String category, Date creationDate)
{
mAuthor = author;
mTitle = title;
mBody = body;
mCategory = category;
mCreationDate = creationDate;
}
}
1 Answer
Oszkár Fehér
Treehouse Project ReviewerHi Khan Your code looking great. Your constructor it's almost ok just missing a crucial element:
this.mAuthor = author;
and for the rest of the variables to. the
this.
keyword needed to initialize your variables Also the
String member
variable in the constructor it's not needed. I hope this will help you out. Happy coding
Jason Anders
Treehouse Moderator 145,860 PointsJason Anders
Treehouse Moderator 145,860 PointsNAJEEBULLAH KHAN
Multiple posts have been deleted for this question. Please refrain from posting multiple threads for the same topic in the Community.
Thank you.
Jason ~Treehouse Community Moderator