A, if, if else, if -_ else if - else if - else three kinds of boolean expressions are determined;
switch () which is an expression on the line, the results determined constants, a number of constants BREAK case, the final default break,
Second, the basic data types and the reference data types:
Example 1: We analyze the difference between "==" and equals () is.
First, I set two String objects
Stringa="abc";
Stringb="abc";
then
if(a==b){
System.out.println("a==b");
}else{
System.out.println("a!=b");}
Program outputs a! = B
Reasons: a and b are not the same address, a == b is the address of two comparison variables
Example 2: define two basic types of
int a=4;
int b=4;
if(a==b){System.out.println("a==b");}
else
{System.out.println("a!=b");}
Output: a == b
The reason: == compares the contents of two variables
Guess: whether the basic data type or reference type, they will allocate a block of memory on the stack, the basic types, this region contains the basic types of content; and the object types, this area contains pointer is a pointer to the real content, a real content being manually allocated on the heap .
Third, the loop structure:
1, ordinary for loop:
2, while circulation
3、do while