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 trialYusuf Mohamed
2,631 PointsI'm litterally copying somones answer but I still get this weird error.
I've tried my own solution but I got this error. Afterwards I tried someone else's answer but I still get the error. This is the error.
./Main.java:16: error: cannot find symbol
forum.addPost(post);
^
symbol: method addPost(ForumPost)
location: variable forum of type Forum
Note: JavaTester.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
It would be very nice if someone could help. Here's the code.
public class Main {
public static void main(String[] args) {
System.out.println("Beginning forum example");
if (args.length < 2) {
System.out.println("Usage: java Main <first name> <last name>");
System.err.println("<first name> and <last name> are required");
System.exit(1);
}
Forum forum = new Forum("Java");
User author = new User(args[0],args[1]);
ForumPost post = new ForumPost(author, "TestTitle", "TestDesc");
forum.addPost(post);
}
}
Yusuf Mohamed
2,631 PointsHehe, thank you Bryan Martinez I actully forgot to uncomment the addPost method. xD
Bryan Martinez
2,227 PointsNo problem! Funny how many times the issue causing us a big headache in programming is just a simple mistake lol
Happy Coding!
Yusuf Mohamed
2,631 PointsHaha, that is so true. We just have to learn how to be thorough when we're coding. Once again thanks for the help.
Bryan Martinez
2,227 PointsBryan Martinez
2,227 PointsHi i'm still learning but I'll give it a shot. Did you uncomment the addPost method in the Forum class? I think you might have forgotten to do this which is why you cannot access addPost. Please let me know if this was the issue. if not I can try some other things. Thanks