日期:2014-05-20  浏览次数:20737 次

这段代码中,有看不懂的地方,求解。
另外,这些基础类的java程序代码,初学者是否需要记忆下来。我感觉有些逻辑用法是约定俗成的。

import java.io.*;  
public class ReadFile{  
  public static void main(String args[]){  
  //以下s, is,ir是用的什么语法声明的?
  String s;      
  FileInputStream is;      
  InputStreamReader ir;      
  BufferedReader in;      
  try { 
  is=new FileInputStream("bbs.txt");        
  ir=new InputStreamReader(is);        
  in=new BufferedReader(ir);        
  while((s=in.readLine())!=null)  //解释下in.readLine()      
  System.out.println("Read: "+s);       
  }catch(FileNotFoundException e){ 
  System.out.println("File not found!");        
  System.exit(-2);      
  } catch(IOException e) { 
  System.out.println("Error:"+e);        
  System.exit(-3);   //  System.exit(-3) 和System.exit(-3); 是什么意思 
  }    
  }  
  }

------解决方案--------------------
LZ需要加強java基礎的學習
------解决方案--------------------
楼主最好从头看下,从基础看起。。。代码不需要硬背,你能看懂了,敲一遍,基本也差不多了
------解决方案--------------------
你看jdk 文档 什么都会了

------解决方案--------------------
这就是基本的IO吧,多看API....感觉刚开始的时候API是很重要的