Java Java Objects Delivering the MVP Arrays and Command Line Arguments

Joshua Thao
Joshua Thao
2,686 Points

How do we set the "Answer" in an IDE? I have Intellij and if I run my code it just says answer is required.

import java.sql.SQLOutput;

import static java.lang.System.*;

public class Hangman {

public static void main(String[] args) {

    if(args.length == 0){ // checking to see if we put an answer for the game
        out.println("Usage: java Hangman <answer>");
        err.println("answer is required!");

    Game game = new Game(args[0]);
    Prompter prompter = new Prompter(game);

    while (game.getRemainingTries() > 0 && !game.isWon()) {



2 Answers

Allan Clark
Allan Clark
Treehouse Moderator 10,754 Points

All IDEs have a place where you can input command line arguments. I am not familiar with Intellij but this StackOverflow question should help.