Topic: 文件读取问题(readLine)???? |
Print this page |
1.文件读取问题(readLine)???? | Copy to clipboard |
Posted by: jsxww2002 Posted on: 2005-05-19 10:30 怎样用readLine()输出指定的行?比如说一行的字符是“12”,比如说用 if 下面的程序????处应该用什么,我用过12 ,12\n 12\r\n 多不行。请问应该用什么? import java.io.*; class route { public static void main(String args[]) throws IOException { String str; int count=0; FileReader fr=new FileReader("mm.txt"); BufferedReader bfr=new BufferedReader(fr); while((str=bfr.readLine())!=null){ count++; if(str=="????") System.out.println("\n"); } System.out.println(count+" lines read"); fr.close(); ? } } |
2.Re:文件读取问题(readLine)???? [Re: jsxww2002] | Copy to clipboard |
Posted by: danzel Posted on: 2005-05-19 16:28 str.equals("????") 建议去看看 == 和 equals的区别 |
3.Re:文件读取问题(readLine)???? [Re: jsxww2002] | Copy to clipboard |
Posted by: jsxww2002 Posted on: 2005-05-19 20:50 谢谢!问题结局了。我是刚开始学JAVA的,以后还要请大家多指点。 |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |