import java.io.*; //引进包
class exceptiondemo{public static void main(string arge[])throws IOException //main抛出IO异常
{
FileInputStream fis = null;  //声明初始化输入文件流try{ system.out.println("first argument is "+args[0]); //显示你输入的第一个参数
fis = new fileinputstream("text");    //初始化fis,读入 text的文件
system.out.println("content of text is :");
int b;
while((b=fis.read())!=-1) //把 text 的文件内容一个一个char的显示出来
{
system.out.priant((char)b);
}}catch(filenotfoundexception e){ //捕获文件不存在异常 system.out.println(e);  //显示异常内容}catch(ioexception e){ //捕获IO异常sysetm.out.println(e);}catch(indexoutofboudsexception e){ //溢出异常system.out.println("closing fileinputstream..");fis.close();  //关文件}else{system.out.println("fileinputstream not open");     }
   }
  }
}

解决方案 »

  1.   

    看你的名字你是不是很喜欢Jay,嘿嘿!^_^
      

  2.   

    写错了很多地方啊,大小写不要混乱了
    跟else配套的if好象我都没看到嘛
      

  3.   

    上面写了注释我就不写了,稍微改了改你的程序import java.io.*;
    class exceptiondemo{
     public static void main(String arge[])throws IOException{
      FileInputStream fis=null;
    try{
      System.out.println("first argument is "+arge[0]);
        fis = new FileInputStream("text");
      System.out.println("content of text is :");
        int b;
      while((b=fis.read())!=-1){
        System.out.println((char)b);
      }
    }catch(FileNotFoundException e){
       System.out.println(e);
    }catch(IOException e){
      System.out.println(e);
    }catch(IndexOutOfBoundsException e){
      System.out.println("closing fileinputstream..");
      fis.close();
    }
       System.out.println("fileinputstream not open");
     }
    }
      

  4.   

    import java.io.*; 
    class exceptiondemo
    {
    public static void main(String args[])throws IOException 
    {
    FileInputStream fis = null;  
    try
    {
    System.out.println("first argument is "+args[0]); 
    fis = new FileInputStream("text.txt");    
    System.out.println("content of text is :");
    int b;
    while((b=fis.read())!= -1) 
    {
    System.out.print((char)b);
    }
    }
    catch(FileNotFoundException e)

    System.out.println(e);  
    }
    catch(IOException e)
    {
    System.out.println(e);
    }
    catch(IndexOutOfBoundsException e)

    System.out.println("closing fileinputstream.."); 
    }
    finally
    {
    if (fis != null)
    {
    fis.close(); 
    }
    else
    {
     System.out.println("fileinputstream not open");
    }
    }
    }
    }
      

  5.   

    嘿嘿! oxv(花生壳) 动作比我快哦!