The second day of Android & Java learning, official android website
Learned the basic types of data
Procedure
Step 1: declare a Variable Step 2: assign a value Step 3: Use a variable
Scope and lifetime of Variables
A variable can declare a block in a code block starting with the left braces and ending with the right braces to define the scope. Each time a new block is created, A new scope variable will be created. The scope of each variable has its own scope. the lifetime of the variable refers to the life cycle of the variable.
Data Conversion Type
Automatic type conversion
When a type of variable is assigned to another type of variable, automatic type conversion occurs if the following conditions are met: two types are compatible; the target type is greater than the source type;
Forced type conversion
Forced conversion is used for explicit type conversion. If the data type of the converted value is greater than the target type, some information is lost.