Javadata type This place will be frequently asked when interviewing, many people do not pay attention to this problem, today to bring you a comprehensive understanding.
Javadata types are mainly divided into:1.Basic data Types2.Reference Data Type3.empty types are described below.
Basic data types include:Byte,short,int,long,char,float,double,booleanTotal8Note: Non-precision storage of floating-point data, integer data for accurate storage. The literal value of the data type has default values: integer type isint, Real type: forDouble
Reference types (also called object types) have5types: Classes, interfaces, arrays, enumerations, callouts
Empty type:void
8the basic types of wrapper classes in:Byte Short Integer Long Character Float Double Boolean
Basic types of advantages: The data storage is relatively simple, the operation efficiency is high.
Packaging class Advantages: Some easy, such as the set of elements must be object type, satisfies theJavaEverything is the thought of the object.
Reference type: The underlying structure and basic types differ greatly
First introduce the followingJVMof memory space:
1. HeapHeap Space: assigning objectsNew Person()
2. Stackstack space: temporary variablePerson per
3.CodeCode Area: class definition, static resourcePerson.class
For example:
Person per = new person();//newcreating objects in the heap space of memory,assign the address of the object toperReference Variable
Per.name ();
The above example implements the steps:
1.JVMLoadingPerson.classto theCodeArea
2.new person ()allocate space in the heap space and create a PersonExample
6.Kassigns the address of this instance to a referenceper, Stack space
If there is an error, please testify,thx
More information: www.kootest.com; Technology Exchange Group: 182526995
Java Basic data types