Operators, control statements knowledge (hetero)

1. (a> b) a:? B: If the brackets is true, it returns a, b false returns.

. 2 && / || and & / | difference: when using false && test is skipped if it is left to the right of inspection, direct returns false, increase efficiency; the same token, || returns true test to the left directly to true; & and | can be bit computing, the latter can not.

3. Keyboard Input: steps of: a leader packet: import java.util.scanner; b create objects / tools Scanner sc = new Scanner (System.in); c obtaining data int x = sc.nextInt ();...

Difference ** nextLine () and next () is: nextLine () will absorb input carriage return, the next () will not accept a carriage return and tab **

4. randomly generated functions: Math.random () returns a value double, in the range [0.0, 1.0]

Math among the commonly used functions:

The Math.abs absolute value function ();

The Math.sqrt square root function ();

Math.round rounding function (); ---- four banker's rounding, when applied to the five parameters of 0.5 (e.g. 2.5 becomes 3, becomes -2.5 -2)

 

 5.string type conversion char type:

String start;

char[] a=start.toCharArray();

6.char-Type string type:

String result= String.valueof(a);

7. The operator priority: monocular bit multiplication and division relationship, logic evaluation after three head.

 

 

Guess you like

Origin www.cnblogs.com/lingxi2b2/p/11900398.html
Recommended