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 trialMUZ140820 Immaculate Ncube
4,611 Pointswhere do the I enter the method here?
help please
import java.util.Date;
public class Movie {
private String mTitle;
private Date mReleaseDate;
public String getTitle() {
return mTitle;
}
public void setTitle(String title) {
mTitle = title;
}
public Date getReleaseDate() {
return mReleaseDate;
}
public void setReleaseDate(Date date) {
mReleaseDate = date;
}
}
}
1 Answer
Ryan Ruscett
23,309 PointsHey,
Notice that there is an OPEN bracket { for the class. A few variables are declared and we see a public method returning a string called getTitle. It too has an OPEN { bracket. Then after the return statement we CLOSE it }. Now this trend continues for each method. At the bottom of the file, we see 3 closing brackets.
1 Bracket closes the setReleaseDate method. 2 Bracket ends the class
There should not be a third bracket, but I assume you tried to type a method or something and removed it and forgot to remove the closing bracket. Anyhow
the end should look like this.
public class Movie {
private String mTitle;
private Date mReleaseDate;
public String getTitle() {
return mTitle;
}
public void setTitle(String title) {
mTitle = title;
}
public Date getReleaseDate() {
return mReleaseDate;
}
public void setReleaseDate(Date date) {
mReleaseDate = date;
}
public String getFormattedReleaseDate() {
return "";
}
}
So just after the closing bracket of setReleaseDate method but before the last closing bracket which closes the class. Insert your method there. Like in the example above.
That is where the method goes.
Let me know if there is anything else I can clarify. Thanks!