Java键盘输入

public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		System.out.println("请输入你的名字:");
		String x = sc.nextLine();
		System.out.println(x);
	}
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		System.out.println("请输入:");
		int x = sc.nextInt();
		System.out.println(x);
	}

 

你可能感兴趣的:(Java)