Java beginners and java beginners
1. jdk (java Development Kit) ------> jre (java Runtime Environment) ------> jvm (java Virtual Machine)
------> Application (javac)
-------> Java API (Util)
2. java running process:
. Java source file -------- javac (Compiled) ------->. class ---------> (java command jvm) Description --------> operating system output
3. Configure environment variables:
Download jdk (csdn, linux community version 1.6-1.8)
4. public static void main (String [] args) {} All java program entries
5. identifier: Something about the name in java 1. class Name: the first letter is in upper case. It cannot start with a number. It cannot use java key words (Reserved). It can contain letters, numbers, _, $. It must be meaningful, camper (when two or more words constitute a name, each letter is capitalized)
2. variable name: cannot start with a number, cannot use java key (Reserved) Words, can use letters, numbers, _, $, to make sense, camper (when two or more words constitute a name, each letter is capitalized)
6. Variable: data type variable name = value;
Int num = 10;
Data type variable name;
Variable name = value;
7. operator: +,-, *,/, %, ++, --, + = ++, add 1 before assignment, after that, assign the value to the variable and then 1. All sums are for example: + =
8. logical operators: >,<,>=, <=, ||,&,=( equal ),! = (Not equal)
9. if (condition ){}
10. Select the structure: if three-object operator (condition? Real results: false results)
If (condition ){
Code blocks;
} Else {
Code blocks;
}
If (condition ){
Code blocks;
} Else if (condition ){
Code blocks;
} Else {
}
Switch (num ){
Case 1:
Code blocks;
Break;
Case 2:
Code blocks;
Break;
Case 3:
Code blocks;
Break;
Default:
Code blocks;
Break;
}
Loop Structure:
While (loop condition ){
Code blocks;
}
Do {
Code blocks;
} While (Cyclic condition );
// Do while will execute the content in do again no matter what the conditions are. while will execute the loop only when the conditions are met.
For (initialization variable; loop condition; increment or decrease variable ){
Code blocks;
}