1 Short-circuit and &&, when its left side is false, the right side is not executed;
Short circuit or ||, when its left is true, the right is not executed.
2 int a=1;
if(a++==2){
a = 7;
}
System.out.println(a);
The output result is 2, because when ++ is to the right of a, first determine whether a is equal to 2, and then add 1; when ++ is to the left of a, first add 1, and then determine whether it is equal to 2
3 Quoting the Scanner data type format:
First import the package outside the class import java.util.Scanner;
Then create a new object of this data type in the class Scanner sc = new Scanner(System.in);
Then call the function int i = sc.nextInt() in the object; //Used to receive the number entered by the console
String s = sc.next();// used to receive the string entered by the console
4 Reference Random data type format
First import the package outside the class import java.util.Random;
Then create a new object of the data type in the class Random rd = new Random(); then call the function in the object
Then call the function int i = rd.nextInt(10) in the object; // used to receive the random integer of [0,10)
double s = rd.nextDouble();// Random decimals used to receive [0.0, 1.0]