I am using a while loop to make sure that the value entered to a scanner object is an integer as such:
while (!capacityCheck) { try { Sys
Use the following:
while (!capacityCheck) { System.out.println("Capacity"); String input = scan.nextLine(); try { capacity = Integer.parseInt(input ); capacityCheck = true; } catch (NumberFormatException e) { System.out.println("Capacity must be an integer"); } }