Java Language Basics
(i) Procedural composition
Slightly
(ii) Data type variables and constants
1. Data type (similar to C #)
boolean bool 8 bit
BYTE 8-128-127
Character Char 16
Short-integer 16
Int 32
Long 64
Float 32
Double 64
2. Identifier-Variable constant method object and class name tag
Alphanumeric also has two special symbols _ and $
Letter underline or dollar sign start
3. Constants
4. Variables
(c) Expressions
1. Assignment and coercion type conversions
Tostring () weak conversion
Type = (type) variable: The value of a= (int) B;a is forcibly converted to int\ b
2. String connection
General is the + number, indicating the connection, as well as + = This column of the combination of symbols, etc.
3. Arithmetic Operation +-*/
4. Relational operations: = = = = = < > etc.
5. Logical operation, relatively complex
& with | or! Take the reverse; | | This type of coincident, right-hand expression may not be executed
6. Bitwise OPERATION: binary unit position >>,<< ~ (binary inverse value),>>> right shift not enough to fill 0
7. When other:b>a?a:b; are mixed, use () can be performed preferentially
8. Priority of operation: strong-Weak
. [] () ~!++--*/+->> <>=! = &| &&| | ?: = (assigned value)
9. Notes
// /**/
(iv) Process Control statements
1. Branch statements
If (A>B)
A
Else
B
Swith (variable, expression)/* differs from C # in case not break;*/
Case value, operation result: statement 1; .... ; default: statement;
2. Looping statements
while (n<10000)
{Executed statement;}
Do
{Executed statement;}
while{conditions of cessation;}
3. Jump statements
Continue:
First-loop:
Execute the statement;
If (condition)
{Continue first-loop;}
Break statement: Only valid if you want to put it in a loop statement
Return statement: Returns, can be followed with parameters, programs, etc., without representing no return value, terminating execution
Non-professional Code farmer Java Learning Note 2 Java language basics