JAVA- basis - expressions, statements

First, the expression

  A calculation formula is referred to as an expression java

  Just an expression expression, not after with a semicolon.

 1 2+3

2 true & false

3 3<5

4 3>2?"yes":"no"

5 str.toUpperCase() 

Second, the statement

  After an expression followed by a semicolon, to form an executable statement.

 

  1. After the usual statement must indicate the end of the statement with a semicolon.

  2. The line can be written in the same time multiple statements, but in order to code simple, a general statement on a separate line.

  3. You can also directly hit a semicolon, such a statement does not, nor will any other logic is called a null statement.

  4. If a statement is {} characterize the effect range, after braces can not write a semicolon.

    

1             2+32             true & false;
3             3<5;
4             3>2?"yes":"no";
5             str.toUpperCase();
6             ;
7             class Person{}

 

Guess you like

Origin www.cnblogs.com/xiaoluohao/p/11305046.html