为什么? System.out.print(s2);写到main方法外面去了放在}前面就可以了。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 import java.io.*;public class test { // Throw exceptions to console: public static void main(String[] args) throws IOException { // 1. Reading input by lines: BufferedReader in = new BufferedReader(new FileReader("test.java")); String s, s2 = new String(); while((s = in.readLine())!= null) { s2+= s + "\n"; } in.close(); System.out.print(s2); }} System.out.print(s2);写到main函数外面了,改成 in.close(); System.out.print(s2); }} String类的问题 有那些 Java技术相关的规范和java框架 关于用JDBC连数据库driver方面的一个问题 请教:编一个局域网内的聊天软件,要求用p2p协议,不很懂需求 有关计算阶乘的程式 求救,在线等:) 为何不正常? package问题 该程序中如何添加main(),很困惑 如何读取一个目录下所有目录? 最最简单的问题,请问怎么在页面中点击按钮后改变按钮名称 求教 图形翻转问题
public class test {
// Throw exceptions to console:
public static void main(String[] args) throws IOException {
// 1. Reading input by lines:
BufferedReader in = new BufferedReader(new FileReader("test.java"));
String s, s2 = new String();
while((s = in.readLine())!= null) {
s2+= s + "\n";
}
in.close();
System.out.print(s2);
}
}
写到main函数外面了,改成
in.close();
System.out.print(s2);
}
}