java base (2) --- basic grammar

First, the program comments

 

 

 Two, HelloWorld

 

 

 Third, keyword

 

 

   

 

 

 Fourth, the constant

 

 

 

 

 

 Five variables

Six Identifier:

 

 

 

 

 Seven, data types

 

 

 

 

 

 

Eight operators:

1, commonly used operators: arithmetic operators, assignment operators, comparison operators, logic operators.

(1) arithmetic operators:

  • Four operators: + - * / [Note: If the divisor and dividend are integers, subject / result obtained is the integer quotient]
  • Modulo operator:% [Note: only the integers modulo operation]
  • Increment decrement operators: +, -
  • String concatenation operators: +

 

 

(2) assignment operator: + =, - =, * =, / =,% =

(3) comparison operators:>, <,> =, <=, ==,! =

(4) logical operators: & (&&), | (||), ^,!

  •   The basic use of: (3 <2 10 & <20) will be executed both sides &

 

  •    Use a short-circuit: &&, || ( . 3 <2 && 10 <20 is) left only be performed &&

  [ Short-circuit: If the left has been determined to be the final result, it will no longer execute right. (Save the effect), higher efficiency]

  

 

 

 

 

 

 

Guess you like

Origin www.cnblogs.com/Lee-yl/p/11617531.html