private static void getNumberOfRunes() throws IOException{ //gets number of runes you have
System.out.println("Please type the number runes you would like to make into a runeword:");
Scanner scan = new Scanner(System.in);
numberOfRunes = scan.nextInt();
if(numberOfRunes <= 0){
System.out.println("You cannot make a runeword with less than 1 rune...");
System.exit(0);
}
else if(numberOfRunes >= 7){
System.out.println("You cannot make a runeword with more than 6 runes...");
System.exit(0);
}
}
This is my code, I have three questions.
1. How do I make an if statement/something that gives the user an error message after typing an int or string for numberOfRunes?
2. Is there a way to clear the screen during the program? Kind of like cls or clear in command prompt?
3. And how could I make one of the if statements loop back to one of the methods, or a certain part of a method.
Thanks, -Nick

New Topic/Question
Reply



MultiQuote







|