Assignemnt #127 display.java
Code
/// Name: Boris Kazantsev
/// Period: 6
/// Program Name: display
/// File Name: display.java
/// Date Finished: 5/29/2016
import java.util.Scanner;
import java.io.File;
public class display{
public static void main(String[] args) throws Exception{
int score;
String fileName = "";
Scanner keyboard = new Scanner(System.in);
while (!fileName.equals("exit"))
{
System.out.print("File name: ");
fileName = keyboard.next();
if (!fileName.equals("exit"))
{
System.out.print("Loading data from \"" + fileName + "\".....");
Scanner fileIn = new Scanner(new File(fileName));
System.out.println("Done");
System.out.println("============================================");
while(fileIn.hasNext())
{
System.out.println(fileIn.nextLine());
}
fileIn.close();
}
}
}
}
Picture of the output