集册 Java实例教程 使用扫描仪从控制台读取int

使用扫描仪从控制台读取int

欢马劈雪     最近更新时间:2020-01-02 10:19:05

433
使用扫描仪从控制台读取int
//时代Java 提供

import java.util.Scanner;


public class EndOfFile {


    public static void main(String cLA[]) {


        Scanner input = new Scanner(System.in);


        int aNumber, anotherNumber;


        while (input.hasNextInt()) {

            aNumber = input.nextInt();

            anotherNumber = input.nextInt();

        }

    }

}