primitive main data types and references

Recognize variables:

1. The state of the object: instance variable and local variable (local variable): the variable defined in the method

2. Variables are used to pass parameters or return types.

3.primitive: ① main data type ② object reference

Tips: For float f=3.25f, it will be treated as float type only if f is added after the number, otherwise it will be treated as double

The word length of the boolean type is determined by the java virtual machine

4. Rules for naming variables:
①: The name must start with a letter, underscore or $ symbol, and cannot start with math.

②: In addition to the first character, the following numbers can be used. Anyway, don't use it in the first character.

③: As long as the above two rules are met, you can name it at will, but you must avoid Java's reserved words

 

Object reference: the method of obtaining an object in bytes (it has nothing to do with its own size)

The method of the object is stored in the variable in the form of bytes, and the object itself exists on the recyclable heap, not in the variable

There are several New(), there are several objects.

Arrays are objects too!

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324757952&siteId=291194637