资料内容:
This has nothing to do with Integer objects— parseInt is a
static method. But the Integer class was a good place to put it.
Caution: The parseInt method and its analog parseDouble
are not intended for parsing user input. They support a specific
format, described in the Java API, that is similar to the format
of decimal Java literals, but without embedded underscores. To
parse human input, use a Scanner . Its nextInt and
nextDouble methods use the current locale, or a locale that
you specify, so that users to can enter the digits and separators
to which they are accustomed.
The API notes show some of the more important methods of the
Integer class. The other number classes implement
corresponding methods.
The wrapper classes also define constants. For all integral
wrapper types, MIN_VALUE and MAX_VALUE are the smallest
and largest value of the type. For example,
Integer.MIN_VALUE is -2147483648 , and
Integer.MAX_VALUE is 2147483647 . Here is a typical
example: