close
執行結果

--------------------Configuration: --------------------
today is friday.註解text awt test

awt test註解

awt testtoday is friday.註解

Process completed.  編譯成功 
1. filereader

import java.io.*; 
public class te13 { 
public static void main(String args[]) throws Exception { 
FileReader fr = new FileReader("poi.txt"); 
BufferedReader br = new BufferedReader(fr); 
String s; //= br.readLine(); 
//if(s != null) {
while((s= br.readLine())!=null){//每行字不是空字串     
System.out.println(s); 
if( s==null) br.close();
}
br.close();
fr.close(); 
} } 


2.fileinputstream

import java.io.*; 
public class te13_01 
 { 
public static void main(String args[]) throws Exception { 
FileInputStream fr = new FileInputStream("poi.txt"); 
byte b[]=new byte[256];
int s=fr.read(b);
if(true){     
if(s!=-1)
System.out.println(new String(b,0,s)); 
if( s==-1)
 fr.close();


}  

arrow
arrow
    全站熱搜

    gtea0609 發表在 痞客邦 留言(0) 人氣()