Operator:
The following are the relevant exercises:
1, the keyboard input a three-bit integer number, please obtain the value of each digit of the three digit number respectively
ImportJava.util.Scanner; Public classTest02 { Public Static voidMain (string[] args) {System.out.println ("Please enter a three-bit integer:"); intValue =NewScanner (system.in). Nextint (); intGewei = value% 10; intShiwei = (VALUE/10)% 10; intBaiwei = value/100; System.out.println ("Number" + value + "The digit is" + Gewei + ", 10 bits is" +Shiwei+ ", Hundred is" +Baiwei); }}
2, say the results of the operation:
Public class Test03 { publicstaticvoid main (string[] args) { int x = 4; int y = (--x) + (x--) + (x*10); SYSTEM.OUT.PRINTLN (// y = +; x = 2 } }
Public classTest05 { Public Static voidMain (string[] args) { Shorts = 30; inti = 50; S+=i; System.out.println ("s=" +s);//s = intx = 0; inty = 0; intz = 0; Booleanb; A= x>0 & y++>1; System.out.println ("A=" +a);//A = FalseSystem.out.println ("y=" +y);//y = 1b = x>0 && z++>1; System.out.println ("b=" +b);//B = FalseSystem.out.println ("z=" +z);//z = 0A = X>0 | Y++>1; System.out.println ("A=" +a);//A = FalseSystem.out.println ("y=" +y);//y = 2b = X>0 | | Z++>1; System.out.println ("b=" +b);//B = FalseSystem.out.println ("z=" +z);//z = 1 } }
3, keyboard input three int type number, 1) to find the minimum value of three numbers and print, 2) to find the number of three and print
ImportJava.util.Scanner; Public classTest07 { Public Static voidMain (string[] args) {Scanner sc=NewScanner (system.in); System.out.println ("Please enter the first integer:"); intNUM1 =Sc.nextint (); System.out.println ("Please enter a second integer:"); intnum2 =Sc.nextint (); System.out.println ("Please enter a third integer:"); intNUM3 =Sc.nextint (); //calculate the maximum value in three numbers intMinValue = Num1 < num2? (Num1 < num3 num1:num3):(num2 < num3?num2:num3); System.out.println (NUM1+ "," + num2 + "," + num3+ "the minimum value in the three numbers is:" +minValue); //calculate the three andSystem.out.println (Num1 + "," + num2 + "," + num3+ "of these three numbers and:" + (num1+num2+num3)); }}
Java basic Syntax (b) < operators >