Advertisement
joseleonweb

Untitled

Feb 27th, 2021
728
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.43 KB | None | 0 0
  1. import java.io.*;
  2.  
  3. public class ShowFile {
  4.  
  5.     public static void main(String[] args) {
  6.         int i;
  7.         FileInputStream fin;
  8.        
  9.         // First make sure that a file has been specified.
  10.         if(args.length != 1) {
  11.             System.out.println("Usage: ShowFile File");
  12.             return;
  13.         }
  14.        
  15.         try {
  16.             fin = new FileInputStream(args[0]); // Open a file.
  17.         } catch(FileNotFoundException exc) {
  18.             System.out.println("File Not Found");
  19.             return;
  20.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement