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 trialkevin nisay
1,159 PointsPlease Help i dont get this part.
public class Example {
public static void main(String[] args) {
System.out.println("Starting forum example...");
if (args.length < 2) {
System.out.println("first and last name are required. eg: java Example Craig Dennis");
}
Forum forum = new Forum("Java");
// Take the first two elements passed args
User author = new User("Kevin", "Nisay");
// Add the author, title and description
ForumPost post = new ForumPost(author,"Android","Developer");
forum.addPost(post);
}
}
i dont get it please help me and can you explain it to me
1 Answer
Jonathan Grieve
Treehouse Moderator 91,252 PointsIt looks like it's checking that the class has been provided at least 2 arguments . If not, you print a warning to the console telling you that you need to provide 2 names for the code to work.
Next you provide the arguments to 3 separate objects by providing new instances or instantiating them.
Then, add the post with the forum class using the addPost() method which is in another file.