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 trialRafał Stasiak
3,763 PointsAfter uncomment ther is syntax error.
Hello, After rechecking work I get below syntax error. Can someone help with fixing my code?
./Main.java:11: error: constructor Forum in class Forum cannot be applied to given types; Forum forum = new Forum("Java"); ^ required: no arguments found: String reason: actual and formal argument lists differ in length Note: JavaTester.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 1 error
1 Answer
Daniel Turato
Java Web Development Techdegree Graduate 30,124 PointsA few things, make sure you uncommented the code in Forum. Also, the author object needs to be created by using the values passed in args like so:
Forum forum = new Forum("Java");
// TODO: pass in the first name and last name that are in the args parameter
User author = new User(args[0], args[1]);
// TODO: initialize the forum post with the user created above and a title and description of your choice
ForumPost post = new ForumPost(author, "test", "test");
forum.addPost(post);
Rafał Stasiak
3,763 PointsHello Daniel,
I created new post with all my code. Please look on this
Rafał Stasiak
3,763 PointsRafał Stasiak
3,763 Pointspublic 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); }
}
}