📄 tij0040.html
字号:
<html><body>
<table width="100%"><tr>
<td>
<a href="http://www.bruceeckel.com/javabook.html">Bruce Eckel's Thinking in Java</a>
</td>
<td align="right">
<a href="tij_c.html">Contents</a> | <a href="tij0039.html">Prev</a> | <a href="tij0041.html">Next</a>
</td>
</tr></table>
<hr>
<H2 ALIGN=LEFT>
Coding
style
</H2>
<DIV ALIGN=LEFT><FONT FACE="Carmina Md BT" SIZE=3 COLOR="Black">The
unofficial standard in Java is to capitalize the first letter of a class name.
If the class name consists of several words, they are run together (that is,
you don’t use underscores to separate the names) and the first letter of
each embedded word is capitalized, such as:
</FONT><P></DIV><DIV ALIGN=LEFT><TT><FONT FACE="Courier New" SIZE=3 COLOR="Black">class
AllTheColorsOfTheRainbow { // ...
</FONT></TT><P></DIV><DIV ALIGN=LEFT><P></DIV><DIV ALIGN=LEFT><FONT FACE="Carmina Md BT" SIZE=3 COLOR="Black">For
almost everything else: methods, fields (member variables) and object handle
names, the accepted style is just as it is for classes
</FONT><FONT FACE="Carmina Md BT" SIZE=3 COLOR="Black"><I>except</I></FONT><FONT FACE="Carmina Md BT" SIZE=3 COLOR="Black">
that the first letter of the identifier is lower case. For example:
</FONT><P></DIV>
<font color="#990000"><PRE><font color="#0000ff">class</font> AllTheColorsOfTheRainbow {
<font color="#0000ff">int</font> anIntegerRepresentingColors;
<font color="#0000ff">void</font> changeTheHueOfTheColor(<font color="#0000ff">int</font> newHue) {
<font color="#009900">// ...</font>
}
<font color="#009900">// ...</font>
}</PRE></font><DIV ALIGN=LEFT><P></DIV><DIV ALIGN=LEFT><FONT FACE="Carmina Md BT" SIZE=3 COLOR="Black">Of
course, you should remember that the user must also type all these long names,
and be merciful.
</FONT><a name="_Toc375545244"></a><a name="_Toc408018445"></a><P></DIV>
<div align="right">
<a href="tij_c.html">Contents</a> | <a href="tij0039.html">Prev</a> | <a href="tij0041.html">Next</a>
</div>
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -