I am trying to read three integers from user.However,as always,i have to check if the input is ok.So i wrote the code,but can not find a way to ensure that the input is ok.InputMismatchException seems to suit but when i write her i get the error : Uncompilable source code - cannot find symbol
Here is my code.What am i missing? :/
static void getInput(int[] input) { System.out.print("Please enter length of phrase,minimum number of words" + " of the essay and maximum number of words : "); try{ Scanner in = new Scanner(System.in); for(int i=0 ; i<input.length ; i++) input[i] = in.nextInt(); } catch (InputMismatchException e) { System.err.println("Unexpected IO ERROR: " + e.toString()); } }
PS1- yes you guess it right i am a newbie,so every tip is a treasure for me
PS2 - how can i wrap my code to something that colours the functions etc.