当前位置:编程学习 > JAVA >>

readLine()

程序一:
String s;
while((s=one.readLine())!=null){
System.out.println(s);
}

程序二:
String s=one.readLine();
while(s!=null){
System.out.println(s);
s=readLine();
}

为什么这两个程序输出结果不一样? readLine --------------------编程问答-------------------- 程序二:
String s=one.readLine();
while(s!=null){
System.out.println(s);
s=one.readLine();
}

是lz笔误么? --------------------编程问答-------------------- 应该一样吧。 --------------------编程问答-------------------- 楼主你看看readLine是怎么实现的,一行的结尾是换行,字符串的结尾是什么。这就是不一样的原因。 --------------------编程问答-------------------- 应该是楼一红色代码的原因吧!
补充:Java ,  Web 开发
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,