"input cannot be resolved" when added a try..catch
- by Mark
I originally tried to get my throw statement to work without a try catch and the userInput = input.nextInt(); line worked fine. But when I tried adding the try..catch it didn't like my input saying it cannot be resolved. I don't think my try..catch is correct yet but I am planning on tackling that after I can get this input to be recognized but I would appreciate any feedback on things you see with that as well.
Thanks
import java.util.Scanner;
public class Program6
{
public static void main(String[] args)
{
final int NUMBER_HIGH_LIMIT = 100;
final int NUMBER_LOW_LIMIT = 10;
int userInput;
try
{
System.out.print("Enter a number between 10 and 100: ");
userInput = input.nextInt();//Says input cannot be resolved
Verify v = new Verify(NUMBER_HIGH_LIMIT, NUMBER_LOW_LIMIT);
}
catch(NumberHighException exception)
{
userInput = 0;
}
catch(NumberLowException exception)
{
userInput = 0;
}
}
}