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 trialSean Flanagan
33,235 PointsMy code is still not right but I don't know why
Hi. Can anyone help me with this please?
Example.java:
import java.util.Date;
import com.teamtreehouse.Treet;
public class Example {
public static void main(String []args) {
Treet treet = new Treet(
"craigsdennis",
"Feeling overwhelmed by learning to #code?" +
"Try out this thought hack I whipped up: http://buff.ly/1LjAZrJ #development #webdev",
new Date(1437084178)
);
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;
}
@Override
public String toString() {
return "Treet: \"" + mDescription + "\" - @" + mAuthor;
}
public String getAuthor() {
return mAuthor;
}
public String getDescription() {
return mDescription;
}
public Date getCreationDate() {
return mCreationDate;
}
}
Error message:
Example.java:3: error: cannot find symbol
import com.teamtreehouse.Treet;
^
symbol: class Treet
location: package com.teamtreehouse
Example.java:7: error: cannot find symbol
Treet treet = new Treet(
^
symbol: class Treet
location: class Example
Example.java:7: error: cannot find symbol
Treet treet = new Treet(
^
symbol: class Treet
location: class Example
3 errors
Snapshot:
I've forked it also.
Thanks in advance.
Sean
2 Answers
Christopher Augg
21,223 PointsHello Sean,
Did you notice that the name of your treet.java file is not the same as your constructor Treet() ?
Rename the treet.java file to Treet.java and it solves the issue.
Regards,
Chris
Christopher Augg
21,223 PointsNo problem Sean. Always glad to help.
Sean Flanagan
33,235 PointsSean Flanagan
33,235 PointsHi Chris. I've renamed the file to your suggestion. Thanks for your help. :-)