Code: Select all
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
public class Scan_v3
{
public static void main(String args[])throws FileNotFoundException
{
Scanner sc = new Scanner(new File(args[0]));
while(sc.hasNextLong())
{
System.out.println(Math.abs(sc.nextLong()-sc.nextLong()));
}
sc.close();
}
}
Main.java:5: class Scan_v2 is public, should be declared in a file named Scan_v2.java
public class Scan_v2
^
1 error
can someone help me ?? And also is this method of Scanning input from file right ??