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 trialAaron Coursolle
18,014 Points[Not fully solved, but at a point where I can take it from here] What are my errors?
Here is my code: [Example.java]
import com.teamtreehouse.Treet;
public class Example {
public static void main(String [] args) {
Treet treet = new Treet(
"craigsdennis",
"Want to be famous? Simply tweet about Java and use the hashtag #treet. I'll use your tweet in a new @treehouse course about data structures.",
new Date(14218497320000L)
);
System.out.printf("This is a new Treet: %s, %n", treet);
}
}
[Treet.java]
package com.teamtreehouse;
import java.util.Date;
public class Treet {
private String mAuthor;
private String mDescription;
private Date mCreationDate;
public Treet(String author, String description, Date creationDate) {
mAuthor = author;
mDescription = description
mCreationDate = creationDate;
}}
public String getAuthor() {
return mAuthor;
}
public String getDescription() {
return mDescription;
}
public Date getDate() {
return mCreationDate;
}
I am getting multiple errors but my ability to start to fix them is complicated because I can't see the first one in the Workspaces Console (Workspaces doesn't allow me to scroll up through the error report).
5 Answers
Jacob Martin
4,182 PointsYou did not close "public class Treet {"
Just throw a closing curly brace at the end of Treet.java
Kshatriiya .
1,464 PointsI think you need to import java.util.Date; in your Example.java too.
Jeremy Hill
29,567 PointsCheck your curly braces, possibly too many.
Aaron Coursolle
18,014 PointsThank you everyone.
Thomas Wilson
18,741 PointsIn example.java when you set the new date you pass an invalid timestamp 14218497320000L There should be no letters in your timestamp.
Aaron Coursolle
18,014 PointsThank you for your answer. In the video he added the L at the end of the timestamp (I believe it stands for "Long"). Without it, even on the video, the compiler displays an error.
Jeremy Hill
29,567 PointsYes any time you use a variable of type long the data should be followed by an 'L'
Jeremy Hill
29,567 PointsJeremy Hill
29,567 PointsIt looks like you might have an extra curly brace in there- I would say that your Treet class constructor has an extra closing curly brace. I would look into that.