📄 java面向对象编程实例详解-java面向对象 - it电子教育门户 高端java培训.htm
字号:
bad()<BR> <BR> {<BR> <BR> return myErrorFlags !=
0;<BR> <BR> }<BR> <BR> <BR> <BR> /**<BR> <BR> * Checks
the EOF status of the file<BR> <BR> * @return true if EOF
was encountered in the previous read<BR> <BR> * operation,
false otherwise<BR> <BR> */<BR> <BR> public boolean
eof()<BR> <BR> {<BR> <BR> return (myErrorFlags & EOF)
!= 0;<BR> <BR> }<BR> <BR> <BR> <BR> private boolean
ready() throws IOException<BR> <BR> {<BR> <BR> return
myFileName == null ||
myInFile.ready();<BR> <BR> }<BR> <BR> <BR> <BR> /**<BR> <BR> *
Reads the next character from a file (any character
including<BR> <BR> * a space or a newline
character).<BR> <BR> * @return character read or null
character<BR> <BR> * (Unicode 0) if trying to read beyond
the EOF<BR> <BR> */<BR> <BR> public char
readChar()<BR> <BR> {<BR> <BR> char ch =
'\u0000';<BR> <BR> <BR> <BR> try<BR> <BR> {<BR> <BR> if
(ready())<BR> <BR> {<BR> <BR> ch =
(char)myInFile.read();<BR> <BR> }<BR> <BR> }<BR> <BR> catch
(IOException e)<BR> <BR> {<BR> <BR> if (myFileName !=
null)<BR> <BR> System.err.println("Error reading " +
myFileName + "\n");<BR> <BR> myErrorFlags |=
READERROR;<BR> <BR> }<BR> <BR> <BR> <BR> if (ch ==
'\u0000')<BR> <BR> myErrorFlags |=
EOF;<BR> <BR> <BR> <BR> return
ch;<BR> <BR> }<BR> <BR> <BR> <BR> /**<BR> <BR> * Reads
from the current position in the file up to and
including<BR> <BR> * the next newline character. The newline
character is thrown away<BR> <BR> * @return the read string
(excluding the newline character) or<BR> <BR> * null if
trying to read beyond the EOF<BR> <BR> */<BR> <BR> public
String readLine()<BR> <BR> {<BR> <BR> String s =
null;<BR> <BR> <BR> <BR> try<BR> <BR> {<BR> <BR> s =
myInFile.readLine();<BR> <BR> }<BR> <BR> catch
(IOException e)<BR> <BR> {<BR> <BR> if (myFileName !=
null)<BR> <BR> System.err.println("Error reading " +
myFileName + "\n");<BR> <BR> myErrorFlags |=
READERROR;<BR> <BR> }<BR> <BR> <BR> <BR> if (s ==
null)<BR> <BR> myErrorFlags |= EOF;<BR> <BR> return
s;<BR> <BR> }<BR> <FONT face=Verdana>/**<BR> <BR> * Skips
whitespace and reads the next word (a string of
consecutive<BR> <BR> * non-whitespace characters (up to but
excluding the next space,<BR> <BR> * newline,
etc.)<BR> <BR> * @return the read string or null if trying
to read beyond the EOF<BR> <BR> */<BR> <BR> public String
readWord()<BR> <BR> {<BR> <BR> StringBuffer buffer = new
StringBuffer(128);<BR> <BR> char ch = ' ';<BR> <BR> int
count = 0;<BR> <BR> String s =
null;<BR> <BR> <BR> <BR> try<BR> <BR> {<BR> <BR> while
(ready() && Character.isWhitespace(ch))<BR> <BR> ch
= (char)myInFile.read();<BR> <BR> while (ready() &&
!Character.isWhitespace(ch))<BR> <BR> {<BR> <BR> count++;<BR> <BR> buffer.append(ch);<BR> <BR> myInFile.mark(1);<BR> <BR> ch
=
(char)myInFile.read();<BR> <BR> };<BR> <BR> <BR> <BR> if
(count >
0)<BR> <BR> {<BR> <BR> myInFile.reset();<BR> <BR> s =
buffer.toString();<BR> <BR> }<BR> <BR> else<BR> <BR> {<BR> <BR> myErrorFlags
|= EOF;<BR> <BR> }<BR> <BR> }<BR> <BR> <BR> <BR> catch
(IOException e)<BR> <BR> {<BR> <BR> if (myFileName !=
null)<BR> <BR> System.err.println("Error reading " +
myFileName + "\n");<BR> <BR> myErrorFlags |=
READERROR;<BR> <BR> }<BR> <BR> <BR> <BR> return
s;<BR> <BR> }<BR> <BR> <BR> <BR> /**<BR> <BR> * Reads
the next integer (without validating its format)<BR> <BR> *
@return the integer read or 0 if trying to read beyond the
EOF<BR> <BR> */<BR> <BR> public int
readInt()<BR> <BR> {<BR> <BR> String s =
readWord();<BR> <BR> if (s != null)<BR> <BR> return
Integer.parseInt(s);<BR> <BR> else<BR> <BR> return
0;<BR> <BR> }<BR> <BR> <BR> <BR> /**<BR> <BR> * Reads
the next double (without validating its format)<BR> <BR> *
@return the number read or 0 if trying to read beyond the
EOF<BR> <BR> */<BR> <BR> public double
readDouble()<BR> <BR> {<BR> <BR> String
</FONT></FONT></P></DIV></SPAN></TD></TR>
<TR>
<TD width="71%"> </TD>
<TD width="29%">【 <A
href="http://www.mldn.cn/print.jtml?articleid=964">打印</A> 】【
<A
href="http://www.mldn.cn/member/favlist.jtml?action=add&postid=964">收藏</A>
】【 <A href="http://www.mldn.cn/email.jtml?articleid=964"
target=_blank>推荐</A> 】 </TD></TR>
<TR>
<TD colSpan=2>
<TABLE cellSpacing=3 cellPadding=0 width="100%" align=center
bgColor=#ffffff border=0>
<TBODY>
<TR height=25>
<TD align=middle width="33%"><IMG height=95 alt=java视频教程
src="Java面向对象编程实例详解-JAVA面向对象 - IT电子教育门户 高端JAVA培训.files/javavideo.gif"
width=642></TD></TR>
<TR>
<TD class=content-table vAlign=top align=middle>
<TABLE>
<TBODY>
<TR>
<TD>
<TABLE>
<TBODY>
<TR>
<TD><A
href="http://www.mldn.cn/articleview/2007-8-21/article_view_2251.htm"
rel=external><IMG class=midImg alt=struts2.0入门视频
src="Java面向对象编程实例详解-JAVA面向对象 - IT电子教育门户 高端JAVA培训.files/struts2.gif"
width=90></A></TD></TR>
<TR>
<TD style="HEIGHT: 22px"> <A
title=struts2.0入门视频
href="http://www.mldn.cn/articleview/2007-8-21/article_view_2251.htm"
rel=external>struts2.0入门视频</A></TD></TR></TBODY></TABLE></TD>
<TD>
<TABLE>
<TBODY>
<TR>
<TD><A
href="http://www.mldn.cn/articleview/2007-6-15/article_view_2141.htm"
rel=external><IMG class=midImg
alt=JAVAEE学习流程和学习方法
src="Java面向对象编程实例详解-JAVA面向对象 - IT电子教育门户 高端JAVA培训.files/j2eejc.gif"
width=90></A></TD></TR>
<TR>
<TD style="HEIGHT: 22px"> <A
title=JAVAEE学习流程和学习方法
href="http://www.mldn.cn/articleview/2007-6-15/article_view_2141.htm"
rel=external>JAVAEE学习流程和学习方..</A></TD></TR></TBODY></TABLE></TD>
<TD>
<TABLE>
<TBODY>
<TR>
<TD><A
href="http://www.mldn.cn/articleview/2007-6-5/article_view_2091.htm"
rel=external><IMG class=midImg
alt=1-Java介绍及JDK配置
src="Java面向对象编程实例详解-JAVA面向对象 - IT电子教育门户 高端JAVA培训.files/javase.gif"
width=90></A></TD></TR>
<TR>
<TD style="HEIGHT: 22px"> <A
title=1-Java介绍及JDK配置
href="http://www.mldn.cn/articleview/2007-6-5/article_view_2091.htm"
rel=external>1-Java介绍及JDK配置..</A></TD></TR></TBODY></TABLE></TD>
<TD>
<TABLE>
<TBODY>
<TR>
<TD><A
href="http://www.mldn.cn/articleview/2007-4-19/article_view_2012.htm"
rel=external><IMG class=midImg alt=Oracle中的多表连接
src="Java面向对象编程实例详解-JAVA面向对象 - IT电子教育门户 高端JAVA培训.files/Oracle.gif"
width=90></A></TD></TR>
<TR>
<TD style="HEIGHT: 22px"> <A
title=Oracle中的多表连接
href="http://www.mldn.cn/articleview/2007-4-19/article_view_2012.htm"
rel=external>Oracle中的多表连接</A></TD></TR></TBODY></TABLE></TD>
<TD>
<TABLE>
<TBODY>
<TR>
<TD><A
href="http://www.mldn.cn/articleview/2007-4-11/article_view_1978.htm"
rel=external><IMG class=midImg
alt=Struts中logic标签的使用
src="Java面向对象编程实例详解-JAVA面向对象 - IT电子教育门户 高端JAVA培训.files/struts.gif"
width=90></A></TD></TR>
<TR>
<TD style="HEIGHT: 22px"> <A
title=Struts中logic标签的使用
href="http://www.mldn.cn/articleview/2007-4-11/article_view_1978.htm"
rel=external>Struts中logic标签..</A></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR>
<TR>
<TD colSpan=2>
<TABLE cellSpacing=3 cellPadding=0 width="100%" align=center
bgColor=#ffffff border=0>
<TBODY>
<TR height=25>
<TD align=middle width="33%" bgColor=#aac4c4><FONT
color=#ffffff>相关文章</FONT></TD>
<TD align=middle width="33%" bgColor=#aac4c4><FONT
color=#ffffff>推荐文章</FONT></TD></TR>
<TR>
<TD class=content-table vAlign=top>
<TABLE>
<TBODY>
<TR>
<TD><A
href="http://www.mldn.cn/articleview/2007-11-7/article_view_2650.htm"
rel=external>垃圾收集器与Java程序的性能</A> <IMG
alt=24小时内新文章
src="Java面向对象编程实例详解-JAVA面向对象 - IT电子教育门户 高端JAVA培训.files/new.gif"
align=absMiddle border=0></TD>
<TD style="TEXT-ALIGN: right"><SPAN
class=link-Date>[11.7]</SPAN></TD></TR>
<TR>
<TD><A
href="http://www.mldn.cn/articleview/2007-11-7/article_view_2652.htm"
rel=external>详细解析Java中抽象类和接口的..</A> <IMG
alt=24小时内新文章
src="Java面向对象编程实例详解-JAVA面向对象 - IT电子教育门户 高端JAVA培训.files/new.gif"
align=absMiddle border=0></TD>
<TD style="TEXT-ALIGN: right"><SPAN
class=link-Date>[11.7]</SPAN></TD></TR>
<TR>
<TD><A
href="http://www.mldn.cn/articleview/2007-11-2/article_view_2624.htm"
rel=external>讲述java语言中内部类的研究</A></TD>
<TD style="TEXT-ALIGN: right"><SPAN
class=link-Date>[11.2]</SPAN></TD></TR>
<TR>
<TD><A
href="http://www.mldn.cn/articleview/2007-11-1/article_view_2618.htm"
rel=external>通过实例学习Java对象的构造过..</A></TD>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -