• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Error occure

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I try to execute the program it not gett executed.

can you help me.

These program is for to show the content in a file.



import java.io.*;

class showfile
{
public static void main(String arg[])
{
int i;
FileInputStream fin;
try
{
fin=new FileInputStream(arg[0]);
}
catch(FileNotFoundException e)
{
System.out.println("File Not Found");
return;
}
catch(ArrayIndexOutOfBoundsException e)
{
System.out.println("Usage File: ShowFile File");
return;
}
do
{
i=fin.read();
if( i != -1)
{
System.out.println((char) i);
}
}while(i!=-1);
fin.close();
}
}


kethare@sify.com
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Considering the code you have given us does not compile, I am not surprized that you are having problems. Exactly what do you mean by "not gett executed"? What do you expect? What errors are you getting?
reply
    Bookmark Topic Watch Topic
  • New Topic