Comparison between Integer and int in Java

  • 2020-06-03 06:41:07
  • OfStack

Method 1:

Integer.parseInt();         返回的是1个 int 的值。

Method 2:


new Integer.valueof();          Returns the  Integer  The object. 
new Integer.valueof().intValue();    It returns the same thing 1 a  int  The value of the. 

Application examples of written test:

Set the following two assignment statements:


a = Integer.parseInt( " 123 " );
b = Integer.valueOf( " 123 " ).intValue();

The following statement is correct (d)

A and a are integer type variables and b is integer class object.

B and a are integer class objects, and b is an integer type variable.

C, a, and b are integer class objects and have equal values.

D, a, and b are integer type variables and have equal values.


Related articles: