看板java
标 题Re: [问题] 关於EOF
发信站无名小站 (Sun Sep 17 19:25:39 2006)
转信站ptt!ctu-reader!ctu-peer!news.nctu!netnews.csie.nctu!wretch
※ 引述《[email protected] (呆河马)》之铭言:
> 我是要判断
> 输入的东西是不是 Ctrl + z
> JAVA也有EOF吗???
> 该怎麽使用
> 是像这样吗? 不过好像不行捏
> while( intput.next() != EOF )
> {
> ................
> }
> 请大家帮我指正一下
Ctrl+Z是MS平台的EOF
linux是Ctrl+D
如果单单由你的想法去写,
换了执行环境会出包的。
以InputStream read()为例
http://0rz.net/921QD
Returns:
the next byte of data,
or -1 if the end of the stream is reached.
以Reader readLine()为例
http://0rz.net/7c1Qu
Returns:
A String containing the contents of the line,
not including any line-termination characters,
or null if the end of the stream has been reached
--
夫兵者不祥之器物或恶之故有道者不处君子居则贵左用兵则贵右兵者不祥之器非君子
之器不得已而用之恬淡为上胜而不美而美之者是乐杀人夫乐杀人者则不可得志於天下
矣吉事尚左凶事尚右偏将军居左上将军居右言以丧礼处之杀人之众以哀悲泣之战胜以
丧礼处之道常无名朴虽小天下莫能臣侯王若能守之万物将自宾天地相合以降甘露民莫
之令而自均始制有名名亦既有夫亦将知止知止可以不殆譬道之在天 163.26.34.248海