Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - What is the difference between direct integer assignment and refactoring assignment in JAVA?
What is the difference between direct integer assignment and refactoring assignment in JAVA?
Int is a basic data type, which directly stores values;

Integer is an object, that is, a class, which is pointed to by reference.

Specific instructions:

1, data types in Java are divided into basic data types and complex data types.

Int is the basic data type.

An integer is an object/class.

2. Initialization method

int I = 1;

Integer i = new integer (1); (think of Integer as a class)

Note: int is a basic data type, which is a trace of process-oriented, but it is a useful supplement to java. Integer is a class, which is an extension of int and defines many conversion methods.

Similarly:

Floating;

double Double

String string;

By analogy, it can be said that Java provides corresponding objects (overlay classes) for each basic data type.