风傲天
p.ID=input.nextInt();Scans the next token of the input as an int.An invocation of this method of the form nextInt() behaves in exactly the same way as the invocation nextInt(radix), where radix is the default radix of this scanner.Returns:the int scanned from the inputThrows:InputMismatchException - if the next token does not match the Integer regular expression, or is out of rangeNoSuchElementException - if input is exhaustedIllegalStateException - if this scanner is closed需要返回一个String类型,如果你的p.ID是一个int类型的确是不符合下面的正常代码是先输入的String类型的str.然后由p.ID = Integer.parseInt(str);int java.lang.Integer.parseInt(String s) throws NumberFormatExceptionParses the string argument as a signed decimal integer. The characters in the string must all be decimal digits, except that the first character may be an ASCII minus sign '-' ('\u005Cu002D') to indicate a negative value or an ASCII plus sign '+' ('\u005Cu002B') to indicate a positive value. The resulting integer value is returned, exactly as if the argument and the radix 10 were given as arguments to the parseInt(java.lang.String, int) method.Parameters:s a String containing the int representation to be parsedReturns:the integer value represented by the argument in decimal.Throws:NumberFormatException - if the string does not contain a parsable integer.转换为int类型的p.ID