/* arithmetic operators use */
Public void test01 () {
//two variables interaction value
//method a
Int num1=1;
Int num2=2;
Int num3=0;//use num3 as intermediate variable
Num3=num1;
Num1=num2;
Num2=num3;
System. Out. Println (" num1: "+ num1);
System. The out. Println (" num2: "+ num2);
}
Public void test02 () {
//for a maximum of integer data type
Int Max=Integer. MAX_VALUE;
System. The out. Println (Max);
//find the smallest integer data type
Int min=Integer. MIN_VALUE;
System. The out. Println (min);
System. The out. Println (" maximum plus 1, become the minimum: "+ (Max + 1));
System. The out. Println (" maximum minus 1, into a maximum: "+ (min - 1));
}
Public void test03 () {
//for under-pressure sieve analyzer plus or minus forever with dividend plus or minus is consistent with the
Int num01=10;
Int num02=- 10;
System. The out. Println (num01%3);//is
System. The out. Println (num01 % - 3);//is
System. The out. Println (num02%3);//negative
System. The out. Println (num02 % - 3);//negative
}
Public void test04 () {
//i++ : use after first add
Int I=1;
Int j=1;
System. The out. Println (i++);//print for the first time: after printing, and then add 1
System.out.println(i);//the second printing: because print for the first time already plus 1, so that's 2
//+ + I: add after first use
System. The out. Println (+ + j);//print for the first time: add 1 first, and then we will print
System. The out. Println (j);
}
Public void test05 () {
//the equal sign (=) on the right is a computational integer: the equal sign (=) with the function of the type conversion
Byte num01=10;//on the right is the int, byte on the left, [=] automatically converts the int type into byte type
Byte num02=20;
System. The out. Println (num01);
System. The out. Println (num02);
Num01 +=num02;//[=] is still on the right type of integer calculation, can automatically convert
System. The out. Println (num01);
//the equal sign (=) on the right is the computational integer, need to force conversion type
//num01=num01 + num02; Complains
Num01=(byte) (num01 + num02);
System. The out. Println (num01);
}
Public static void main (String [] args) {
Test02 test=new test02 ();
//test test01 ();
//test test02 ();
//test test03 ();
//test test04 ();
Test. Test05 ();
}
}
CodePudding user response:
So what are you trying to say,,,