import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.StringTokenizer;
public class EnglishShow {
public void show() throws IOException{
String name="C:\\Users\\Administrator\\Desktop\\123.txt";
BufferedReader bf=new BufferedReader(new FileReader(name));
String work="";
while( (work=bf.readLine())!=null)
{
StringTokenizer s=new StringTokenizer(work);
while(s.countTokens()!=0){
System.out.println(s.nextToken());
}
}
bf.close();
}
/**
* @param args
* @throws IOException
*/
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
EnglishShow e=new EnglishShow();
e.show();
}
}
用记事本程序创建一篇包含几十个英语单词的小文章,要求从屏幕输出每一个单词。(StreamTokenizer、StreamTokenizer类)
最新推荐文章于 2023-01-23 00:06:38 发布