1. The difference between int and integer
int is the basic data type, and integer is a reference data type.
e.g:
int num = 100; Not an Object
Integer i = 100; is an object
Num. Properties and methods are not out of order
I. Point-out properties and methods
Integer is the boxed class of the integer type, which can be boxed and unboxing
i = num; Automatic Boxing
num = i; Automatic unpacking
Boxing--"Converting a value type to a reference type
Unpacking-"Converting a reference type to a value type"
-Integer is an int type encapsulation class, int is not an object base type ->integer is an object reference type
2, = = and equals () the difference?
for = =, if both sides are numeric values, indicate whether the values are equal, if the two days are reference types, the objects are the same. ->equals () to determine whether the contents of the two objects are the same.
String s1 = "Hello" ; string s2 = new String ("Hello" = new String ("Hello" = = s2); // SYSTEM.OUT.PRINTLN (s2 = = s3); // system.out.println (s1.equals (S2)); // System.out.println (S2.equals (S3)); //
string S1 = "Hello"= "Hello"new String ("Hello"// true// false// true// True
"Java" Java basics