System.in.read() method

后端 未结 6 1380
太阳男子
太阳男子 2020-12-02 03:03

Following is the code, I have written to get two inputs from user. But when I run the program, It takes only one input and generate other by itself and calculate the wrong v

6条回答
  •  一生所求
    2020-12-02 03:43

    Try using a Scanner object to read your user's input :

    Scanner scanner = new Scanner(System.in);
    int x = scanner.nextInt();
    

提交回复
热议问题