6.0数据输入:

数据输入:

1.导包:import java.util.Scanner;

2.创建对象:Scanner sc = new Scanner(System.in);//只有sc为变量名

3.接受数据:int i = sc.nexInt(); //只有i为变量名可变,其他不可变

import java.util.Scanner;

public class ScannerDemo{

  public static void main(String[] args){

    Scanner sc = new Scanner(System.in);

    int x = sc.nexInt();

    System.out.println("x" + x);

  }

}

posted @ 2021-07-16 21:38  慢漫曼蔓  阅读(65)  评论(0)    收藏  举报