锘??xml version="1.0" encoding="utf-8" standalone="yes"?>
6. Break up classes with too many responsibilities.
The javac compiler always looks for files in the current directory, but the java interpreter only looks into the current directory if the "." directory is on the class path. If you have no class path set, this is not a problem鈥攖he default class path consists of the "." directory. But if you have set the class path and forgot to include the "." directory, then your programs will compile without error, but they won't run.
Features tagged as public can be used by any class. Private features can be used only by the class that defines them. If you don't specify either public or private, then the feature (that is, the class, method, or variable) can be accessed by all methods in the same package.
Here, docDirectory is the name of the directory where you want the HTML files to go. Follow these steps:
1.
|
Change to the directory that contains the source files you want to document. If you have nested packages to document, such as com.horstmann.corejava, you must be working in the directory that contains the subdirectory com. (This is the directory that contains the overview.html file if you supplied one.)
|
2.
|
Run the command
|
鍦?/span>Java涓紝鏁村瀷鐨勮寖鍥翠笌榪愯java浠g爜鐨勬満鍣ㄦ棤鍏熾傚湪C/C++紼嬪簭涓紝int綾誨瀷鍗犵敤鐨勫瓧鑺傚彲鑳戒細鍥犱笉鍚屾満鍣ㄤ笉鍚屾搷浣滅郴緇熻屼笉鍚岋紱鑰屽湪java涓紝鍚勭鏁村瀷鐨勫瓨鍌ㄩ渶姹傚凡緇忚鏄庣‘瀹氫箟(int: 4 bytes; short: 2 bytes; long: 8 bytes; byte: 1 byte)錛屼粠鑰屽疄鐜頒簡騫沖彴鏃犲叧鎬с?/span>
甯哥敤鏁村瀷銆佹誕鐐瑰瀷甯擱噺錛?/span>
l Integer.MAX_VALUE
l Ingeger.MIN_VALUE
l Double.POSITIVE_INFINITY (姝f棤絀峰ぇ)
l Double.NEGATIVE_INFINITY (璐熸棤絀峰ぇ)
l Double.NaN (Not a number)
PS: 鍒ゆ柇涓涓壒瀹氬兼槸鍚︾瓑浜?/span>Double.NaN:
if (x == Double.NaN) //is never true
Should use:
if (Double.isNaN(x)) // check whether x is “Not a number”
char 綾誨瀷鐢ㄤ簬琛ㄧずUnicode緙栫爜鐨勫瓧絎﹀崟鍏冦?/span>Unicode鍙〃紺轟負16榪涘埗鍊鹼紝浠?/span>"u0000鍒?/span>"uffff銆?/span>
鍏充簬Unicode: 鍦?/span>Unicode鍑虹幇鍓嶏紝宸茬粡鏈変簡寰堝鐨勫瓧絎︾紪鐮佹爣鍑?/span>(濡傜編鍥界殑ASCII, 瑗挎鐨?/span>ISO 8859-1, 淇勭綏鏂殑KOI-8, 涓浗鐨?/span>GB118030鍜?/span>BIG-5錛?/span>etc)錛岃繖鏍烽犳垚浜嗕袱涓棶棰橈細a). 瀵逛簬緇欏畾鐨勪唬鐮佸鹼紝涓嶅悓鐨勭紪鐮佹柟妗堜笅鍙兘瀵瑰簲涓嶅悓鐨勫瓧姣?/span>; b). 閲囩敤澶у瓧絎﹂泦鐨勮璦鍏剁紪鐮侀暱搴﹀彲鑳戒笉鍚岋紝e.g., 鏈変簺甯哥敤鐨勫瓧絎﹂噰鐢ㄥ崟瀛楄妭緙栫爜錛岃屽彟涓浜涘瓧絎﹀垯闇瑕佷袱涓垨鏇村瀛楄妭銆?/span>璁捐Unicode灝辨槸涓轟簡瑙e喅榪欎簺闂銆備絾閬楁喚鐨勬槸錛岀粡榪囦竴孌墊椂闂達紝Unicode瀛楃瓚呰繃浜?/span>65536涓紝鐜板湪錛岃繛16浣嶇殑char綾誨瀷涔熷凡緇忎笉鑳芥弧瓚蟲墍鏈?/span>Unicode瀛楃鐨勯渶姹備簡銆?span style="color: red">寮虹儓寤鴻涓嶈鍦ㄧ▼搴忎腑鐢?/span>char綾誨瀷銆?/span>
褰撳皢涓涓瓧絎︿覆鍜屼竴涓潪瀛楃涓茬殑鍊艱繘琛屾嫾鎺ユ椂錛屽悗鑰呰杞崲鎴愬瓧絎︿覆銆?/span>E.g:
int age = 24;
String s = “abce” + age; //age琚漿鎹㈡垚瀛楃涓詫紝緇撴灉涓?#8220;abcd24”銆?br />
Javac灝?java鏂囦歡緙栬瘧鎴?class鏂囦歡錛屽彂閫佸埌jvm, jvm鎵ц緙栬瘧鍣ㄥ瓨鏀懼湪.class鏂囦歡涓殑瀛楄妭鐮併?
榪愯applet錛?). 鐩存帴鐢ㄦ祻瑙堝櫒鎵撳紑html錛岃html閲屽寘鍚玜pplet銆?). appletviewer ***.html銆俛pplet宓屽叆鍒癶tml鐨勫啓娉曞涓?
<html>
<head></head>
<body>
......
<applet code = "WelcomeApplet.class" width="400" height="200">
<param name = "greeting" value="Welcome to core java!" />
</applet>
</body>
<html>