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
Usman Javaid
472 PointsNot able to compile
I have created folder structure com/teamtreehouse/ and created the file Treet.java as mentioned in the lecture. Then in com/ folder, I created Example.java which has the following code.
import com.teamtreehouse.Treet; public class Example { public static void main (String[] args) { Treet treet = new Treet(); System.out.printf("This is a new Treet: %s %n", treet); } }
However, I am getting the following error on compilation (javac Example.java)
import com.teamtreehouse.Treet;
^
Example.java:9: error: cannot find symbol
Treet treet = new Treet();
^
symbol: class Treet
location: class Example
Example.java:9: error: cannot find symbol
Treet treet = new Treet();
^
symbol: class Treet
location: class Example
3 errors
Can anybody help please???
2 Answers
Charles Wanjohi
9,235 PointsAdd the .java extension to the file import..
import com.teamtreehouse.Treet.java
The error is in you not having fully specified the file being imported
Nikolay Shelepov
1,517 PointsHello!
Did you create constructor of class Treet like this:
public Treet(String author, String description, Date creationDate) {
mAuthor = author;
mDescription = description;
mCreationDate = creationDate;
}
If you have this constructor, then you need create instance of class Treet using constructor with parameters, i think. I hope its helps.