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

使用扫描仪从控制台读取长值

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

467
使用扫描仪从控制台读取长值

import java.util.Scanner;


public class LongInputOutput {
//nowjava.com

    public static void main(String cLA[]) {


        Scanner myInput = new Scanner(System.in);


        long firstNumber, secondNumber, summation;


        firstNumber = myInput.nextLong();

        secondNumber = myInput.nextLong();


        summation = firstNumber + secondNumber;


        System.out.printf("%d\n", summation);

        System.out.printf(summation + "\n");/** from nowjava.com**/

    }

}