Keyboard entry (Java):
1. Guide package
Format
import java.util.Scanner;
Position
. .Create keyboard input object
Format
Scanner sc = new Scanner(System.in);
3. Obtain data through the object
Format
int x = sc.nextInt();
import java.util.Scanner;
class ScannerDemo { public static void main(String[] args) { //创建键盘录入数据对象 Scanner sc = new Scanner(System.in); int x = sc.nextInt(); } }
The above is the detailed content of java keyboard entry. For more information, please follow other related articles on the PHP Chinese website!