Read long value from console using Scanner - Java File Path IO

Java examples for File Path IO:Scanner

Description

Read long value from console using Scanner

Demo Code

import java.util.Scanner;

public class LongInputOutput {

    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");
    }/*  www .  j  av  a 2  s  .  c  om*/
}

Related Tutorials