Knowledge Point Consolidation:
1. How to define variables and initialize them
Data type variable name = initialization data;
2. Scope of variables: Global variables, local variables.
Knowledge Points of Learning:
1. Conversion of data types:
The conversion of data types is divided into two main categories: automatic conversion, casting
1) Auto-convert (implicit conversion ): target type = original type. ---------------------- Knowledge point Truth . doc
Feature: Convert from a small range of data types to a wide range of data types. Byte the Short the Int the Long
Note: in Java ,when theByte/short/char is evaluated, it converts itself to the int type before calculating.
2) forcing data type conversions
Note: You should use caution, the problem of poor accuracy of results when casting, or the information of error.
2. Operators
Arithmetic operators, assignment operators, relational operators, logical operators, bitwise operators, (ternary operators)
1) Arithmetic operators:+,-,*,/,%,--,++,+(String connector). ++before a variable equals: The variable itself+1, and then perform other operations. int num1=num++;after the variable is placed, the other operation is done first, and the variable itself+1.
2) Assignment operator: = , += -= , *= , /= %= num+=2; num=num+2;
3) relational operators:= =,! =,>,<,<=,>= . The result of a relational operator operation is a Boolean. Use range: expressions, looping statements, and so on.
Java Foundation 1 (2015-8-2)