object and base type :
string s = new String ("abc");
S is a reference, referencing an object with a value of ABC, which is stored in the heap
Basic type : As a special "basic type" in Java, (for efficient processing of data), that is, not to create a variable with new, but rather to create an "automatic" variable that is not a reference. This variable stores the value directly and places it on the stack.
features : The basic types in Java do not change as the hardware architecture changes, uniquely determining the size of the storage space, unlike the basic C + + data
Basic types and wrapper types
Boolean Boolean
Char Character
BYTE byte
Short Short
int Integer
Long Long
float float
Double Double
void void
you can use the wrapper type in the heap to correspond to the basic types that exist in the stack :
char c = ' x ';
Character ch = new Character (c); Character ch = new Character (' X ');
Charcter ch = ' x '; (Automatic conversion, ' X ' automatically converted to an object, then referenced by CH)
char c = ch; (Reverse conversion)
In summary: That is, C and ch " pricing "
Class: field + method
Fields :
the base type in the field is the normal basic type :
Object of base type in field : Default value Exists
Objects of the ordinary basic type definition : If no initialization is directly considered an error in Java, the compiler in C + + will only warn
Method :
method is called by an object and A.F () is understood to send a message to an object
stactic fields and methods : All objects of the same class share the same storage space, and can be called directly with the class name without invoking a specific object
Thinking in Java 16/3/6