First Tucao a lot amount of work today. . . .
Let me Kankan today over what
First, the binary conversion
Ary premise should be an integer
0b is the beginning of a binary 0 is the beginning of the beginning octal 0x are hexadecimal.
E represents scientific notation represented 10 E2 10 10 ^ 2 e2 represents ^ -2
Second, the escape character
\ B cursor back one space \ n newline \ r cursor to the beginning \ t ostensibly blank space is actually eight characters representing a two spaces, a space representing a letter
Third, the advantages and disadvantages of expanding the assignment operator
+= -= *= /= %=
Improve the efficiency advantages of automatic do cast
The disadvantage is not intuitive
Fourth, the logical operators ^
The same is true for the different false
Examples: true ^ false is true different results
true ^ true is the same result is false
false ^ false is the same false
Fifth, the conditional operator?:
I always remember to this! :
So write about yourself deeper impression. . . . . . .
Sixth, Bitwise operators, although I think this is the key but hard to remember unimportant
Bitwise operators
all operands into binary form to participate in operation, then the result is converted to decimal form
&: Two numbers the same location, a 0 is 0, 1 is both 1
|: Two numbers the same location, a is 1 to 1, both 0 is 0
^: The same two numbers the same position is 0, 1 different
The shift operators
Right: >> binary operands, move to the right the number of bits of the second operand, the result of the right side of the watershed do not, leaving only the left side, and the result to decimal
pure calculation, then -> The first operation D / 2 operations several times a second side num1 / (2 ^ num2)
Left: << binary operand, the left shift bit number of the second operand, the position of the spare 0s, the results obtained to decimal
purely computational words -> second first operand 2 * * several operations square num1 (2 ^ num2) written on the intuitive
Seven Scanner class
next () receives the end of the string functions: enter, do not enter the receiving
starts receiving the valid character, experience space, tab is not accepted, but must be met enter the end of the function
nextLine () as long as no new line, you can receive encountered enter end function, receiving the Enter
nextInt () connected to digital
nextDouble () .... then decimals
.close () after turning the useless ~ reopened
Enter directly the result of processing problems can not plug a variable assignment. nextLine ();
Eight random class
Reference .nextInt (max-min + 1) + min
Nine switch this custom judge very interesting
switch (expression) {
Case Value 1:
Statement body 1;
BREAK;
Case 2 values:
; statement body 2
BREAK;
....
default:
statement body n-;
BREAK;
}
A break occurs no case where the penetration is no break in the case of not matching the following conditions directly execute the following statements all the statements 3 4 5 statement .. . . .
Two default action is consistent with the else case above conditions are not met, the statement is executed in the default body
int season = scan.nextInt (); // season
Season Season = /. 3;
Switch (Season) {
Case. 1:
System.out.println ( "Spring");
BREAK;
Case 2:
System.out.println ( "summer ");
BREAK;
Case. 3:
System.out.println (" ball days ");
BREAK;
Case. 4:
System.out.println (" winter ");
BREAK;
Case 0:
System.out.println (" winter " );
BREAK;
}