Thinking in java reading note - Chapter 2

xiaoxiao2021-03-05  24

Everything is object

A memory:

1. Stack:

Instances of the object, basic type, etc .;

2. heap:

Store objects, class types, etc .;

3. Static storage:

Sticked the Static variable.

Data type:

Basic Type Size Minimum Value Maximum Class Type Default Boolean1-Bit - Boolean Falsechar16-Bitunicode 0Unicode 216- 1CHARACTER '/ U0000'Byte 8-BIT-128 127BYTE 0short16-Bit-215 215 - 1short 0int32-bit- 231 231 - 1integer 0long64-bit-263 263 - 1long 0LFLOAT32-BITIEEE754IEEE754FLOAT 0FDOUBLE64-BIT IEEE754IEE754DOUBLE 0DVOID --- Void Null

Note:

There are two types of types:

1) Biginteger supports an integer of any precision;

2) BigDecimal supports the floating point number of any precision.

Three scope:

1. Class data variables or object variables are not initialized, virtual opportunities assign their default values ​​themselves;

2. Local data variables or object variables (all variables within the method) If there is no initialization, it will be wrong when compiling.

Four static keywords:

When you declare a data variable or method for static, it means that the data variable or method is not connected to any instance of the class, so you don't have to create a class's object variable, you can use Static defined data variables or method.

Note:

The data variables or methods generally defined in Static will be referred to as class variables or class methods.

转载请注明原文地址:https://www.9cbs.com/read-39148.html

New Post(0)