If the negative number is modulo, the modulus symbol can be ignored, such as: 5%-2 = 1
for/, Integer divide and decimal divide are distinguished, integers are divide, and integers are preserved to remove remainder
+ Besides the function of string addition, we can convert non-string into string
System.out.println ("5+5=" +5+5); 5+5=55
System.out.println (' * ' + ' \ t ' + ' * '); 93SYSTEM.OUT.PRINTLN ("*" + ' \ t ' + ' * '); //* *
Public classTestApp {@Test Public voidTest () {intI1 = 10, I2= 20; inti = i1++; System.out.print ("I=" +i);//i=10System.out.println ("i=" +i1);//i=11I= ++I1; System.out.print ("I=" +i);//i=12System.out.println ("i=" +i1);//i=12I= i2--; System.out.print ("I=" +i);//i=20System.out.println ("i=" +i2);//i=19I= --I2; System.out.print ("I=" +i);//i=18System.out.println ("i=" +i2);//i=18 }}
Assignment operators:
You can use automatic types for type conversions when data on both sides is inconsistent
public class TestApp {@Test public void Test () { boolean B1 = false ; // if (B1 = true " System.out.println ( "The result is true" else System.out.println ( "Result false"
Public class TestApp { @Test publicvoid Test () { int i = 1; *= 0.1; System.out.println (i); // 0 i++; System.out.println (i); // 1 }}
Comparison operators
logical operators
An expression that is used by logical operators to concatenate Boolean types
The difference between & and &&:
&, whether true or false, both sides are to be operated on.
&&, the left is false, not the operation on the right
^ (XOR) and (|) Differences: When both sides are true, the result is false
@Test Public voidTest () {intx = 1; intY=1; if(X++==2 & ++y==2) {x=7; } System.out.println ("X=" +x+ ", y=" +y);//x=2,y=2x= 1; Y= 1; if(x++==2 && ++y==2) {x=7; } System.out.println ("X=" +x+ ", y=" +y);//X=2,y=1x= 1; Y= 1; if(X++==1 | ++y==1) {x=7; } System.out.println ("X=" +x+ ", y=" +y);//x=7,y=2x= 1; Y= 1; if(X++==1 | | ++y==1) {x=7; } System.out.println ("X=" +x+ ", y=" +y);//X=7,y=1}
Bitwise operators
Java basic Syntax (operator)