Assignemnt #124 Summing Three Numbers From a File

Code

import java.util.Scanner;
import java.io.File;

public class SummingThreeNumbers
{
    public static void main(String[] args) throws Exception
    {
        Scanner fileIn = new Scanner(new File("3nums.txt"));
        
        int a = fileIn.nextInt();
        int b= fileIn.nextInt();
        int c = fileIn.nextInt();
        int sum = a + b + c;
        
        System.out.println("\nReading numbers from file...");
        Thread.sleep(400);
        System.out.println(a + " + " + b + " + " + c + " = " + sum + "\n");
    }
}
    

Picture of the output

Assignment 1