Assignment Operation symbols
Unary operators
Arithmetic operators
Relational operators
Increment and decrement operators
PublicClassT{PublicStaticvoidMain(String[]Args){IntA=3,B=3;Define two variables A and bIntX=6,Y=6;Define two variables x and ySystem.Out.println("A ="+A);System.Out.println("\ t a++ ="+(A++)+", a ="+A);The first calculation after the self-incrementSystem.Out.println("B ="+B);System.Out.println("\ t ++b ="+(++B)+", B ="+B);First self-increment after calculationSystem.Out.println("x ="+X);System.Out.println("\ t x--="+(X--)++ x) //first calculated auto minus system.. ( "y =" + y) system.. ( "\ t--y =" + (--y+ + y //first subtract
Result of Operation
a = 3 a++ = 3 , a = 4 b = 3 ++b = 4 , b = 4 x = 6 x-- = 6 , x = 5 y = 6
logical operators
Whether it is a short-circuit or a non-short-circuit, its basic operating results are the same.
The following error codes are available:
public class T { public static void main(String[] args) { int i = 10/0; System.out.println(i); } }
The code above will cause problems as soon as it runs.
public class t {public static void main (string [] args) {if10!=10&10 /0==0) {system out. ( "condition satisfies" } } } /span>
Short Circuit and
public class t {public static void main (string [] args) {if10!=10&&10 /0==0) { System.. ( "condition satisfies" } } } /span>
As long as the first condition is satisfied, then the program code is not executed.
Bitwise operators
Result table of the bitwise operator
PublicClassT{PublicStaticvoidMain(String[]Args){IntX=3;3 binary data: 00000000 00000000 00000000 00000011IntY=6;6 binary data: 00000000 00000000 00000000 00000110System.Out.println (x & y //with: 00000000 00000000 00000000 00000010 system. Out. (x | y //or: 00000000 00000000 00000000 00000111 system. Out. (x ^ y) Span class= "C1" >//or: 00000000 00000000 00000000 00000101 } }
Copyright NOTICE: This article uses the BY-NC-SA agreement to authorize, reproduced the Wheat Field Technical blog article please indicate the source
Original address: Http://itmyhome.com/2015/03/java-study-notes-operator-expression
Java Learning Notes 02--operators, expressions