Develop a Java program to display the content of a file supplied as command line argument.

import java.io.*;
class Exp11_1
{
 public static void main(String[] args)
 {
  FileInputStream in = null;
  try
  {
   in = new FileInputStream(args[0]);
   int c;
   while((c=in.read())!=-1)
    System.out.print((char)c);
   in.close();
  }
  catch(Exception e)
  {}
 }
}
/*  OUTPUT!!!
N:\Study Link\Exp 11>javac exp11_
1.java
N:\Study Link\Exp 11>java Exp11_1 sample.txt
Welcome to YDriod Expo
Where
Knowledge is Power
*/


Java Programs

Copyright © LetML. Blogger Templates Designed by OddThemes