Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Java

kevin nisay
kevin nisay
1,159 Points

Please 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
MOD
Jonathan Grieve
Treehouse Moderator 91,028 Points

It 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.