I don't have to much experience in java and I'm currently taking a tutorial in java. But I have a problem with a thing that I already seen a couple of times in this tutorials. Here is my code:
public class GuessingGame {
public static void main(String args[]) {
int randomNum = 0;
int argument;
if (args.length == 0 || args[0].compareTo("help") == 0) {
System.out.println("Usage: GuessingGame [argument]");
System.out.println();
System.out.println("help print this help message");
System.out.println("Enter 1-5 as your guess");
} else {
randomNum = ((int)(Math.random() * 5) + 1);
argument = Integer.parseInt(args[0]);
if (argument < 1 || argument > 5) {
System.out.println("Invalid argument !!!");
} else {
if (argument == randomNum) {
System.out.println("Great Guess - You got it right !!!");
} else {
System.out.println("Sorry the number was: " + randomNum + ". Try again !!!");
}
}
}
}
}
The tutorial that I take it is little bit old so it uses jEdit and command prompt to compile this program and I use IntelliJ. The problem is that when I run the program it just print those lines and I don't understand how to insert a number in order to make this program useable.