java 遍历读取文件 搜索相应字符 打印出所在行
------解决方案--------------------
- Java code
import java.io.*;class FileOperate { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new FileReader("filename")); String line; while((line=reader.readLine())!=null) if(line.contains("char")) System.out.println(line); }}