if(s.hasNextInt())
{
Out.println("Int: " + s.nextInt()); // Reads the int found by hasNextInt
ArrayInt.add(s.nextInt()); // This reads the next value. What is it??
The...
Type: Posts; User: Norm
if(s.hasNextInt())
{
Out.println("Int: " + s.nextInt()); // Reads the int found by hasNextInt
ArrayInt.add(s.nextInt()); // This reads the next value. What is it??
The...
The call to hasNext() does NOT read anything. Use next() to read the non-integer.
For debugging add a print statement that prints out the values that were skipped.
The Scanner class has methods that will tell you what data type the next token to be read is. Look at the hasNext... methods.
If you only want to read integer values, use the hasNextInt method to...