0
Is it possible to brake out of a scanner string input so it reads an int instead "purposely"?
or no matter what i write will it always be trapped within "these quotations marks"?
1 Respuesta
0
Not sure what your question is, but Scanner has different methods to read from input, including for instance nextInt() to return an int. Alternatively, you could parse the String to an int using Integer.parseInt(scanner.nextLine()); or Integer.valueOf(scanner.nextLine()); assuming the next line contains an Integer (or handle possible exceptions).