java的IO程序

[复制链接]
查看11 | 回复1 | 2010-11-6 17:41:03 | 显示全部楼层 |阅读模式
import java.io.*;
public class TestPrintStream2{
public static void main(String[] args){
String filename=args[0];
if(filename!=null){list(filename,System.out);}
}

public static void list(String f,PrintStream fs){
try{
BufferedReader br=new BufferedReader(new FileReader(f));
String s=null;
while((s=br.readLine())!=null){

fs.println(s);
}
br.close();
}catch(IOException e){
fs.println("无法读取文件");
}
}
}
这段小文件错在哪里可以编译,运行时出错could not find the main class
我怎么不懂怎么解决

回复

使用道具 举报

千问 | 2010-11-6 17:41:03 | 显示全部楼层
我运行没有问题啊,你的环境有问题吧
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行