Java Programs[Important]
-   WRITE A JAVA PROGRAM that reads a file and
displays the file on the screen, with a line number before each line.
 
-  
 
- Program :
 
-  
 
- import   java.io.*;
 
-  class LineNum
 
- {
 
-  public static void
main(String args[])
 
- { 
 
- String thisline;
 
-  for(int i=0;i<args.length;i++)
 
-  {
 
-  try{
LineNumberReader br=new LineNumberReader(new FileReader(args[i]));
 
-  while((thisline=br.readLine())!=null)
 
-  { 
 
- System.out.println(br.getLineNumber()+"."+thisline); 
 
- } 
 
- }
 
- catch(IOException e)
 
- {
 
-  System.out.println("error:"+e);
 
 
- }
 
-  }
 
-  }
 
-  }