Advertisement
Guest User

Main.java solution for Challenge "Forum"

a guest
Jan 20th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.87 KB | None | 0 0
  1. public class Main {
  2.  
  3.   public static void main(String[] args) {
  4.     System.out.println("Beginning forum example");
  5.     if (args.length < 2) {
  6.       System.out.println("Usage: java Main <first name> <last name>");
  7.       System.err.println("<first name> and <last name> are required");
  8.       System.exit(1);
  9.     }
  10.     // Uncomment this when prompted
  11.     Forum forum = new Forum("Java");
  12.     // TODO: pass in the first name and last name that are in the args parameter
  13.     User author = new User(args[0],args[1]); // Get name from arguments
  14.     // TODO: initialize the forum post with the user created above and a title and description of your choice
  15.     ForumPost post = new ForumPost(author, "A title", "A description"); // Use the User created above as the first argument
  16.     forum.addPost(post); // Use the ForumPost created above to add a post to the forum
  17.  
  18. //
  19.   }
  20.  
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement