4

違いは何ですか

Runtime.exit(0) と System.exit(0)

同様に、違いは何ですか

Runtime.gc() と System.gc()

いつどれを使う?

4

4 に答える 4

2

System.Xxxx の方が短いです。Runtime.Xxxx() を直接使用することはできません。

于 2012-04-25T10:24:33.150 に答える
2

違いは何ですか

Runtime.exit(0) and System.exit(0)

なし。

同様に、違いは何ですか

Runtime.gc() and System.gc()

なし。

いつどれを使う?

違いがないので、選択は純粋に表面的なものです。

于 2012-04-25T10:50:16.477 に答える
1

javadocs を見てみましょう: http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/System.html#exit(int )

「呼び出し System.exit(n) は実質的に次の呼び出しと同等です: Runtime.getRuntime().exit(n)」

于 2012-04-25T10:24:03.480 に答える
0

なし、同じです。

http://docs.oracle.com/javase/7/docs/api/java/lang/System.html

于 2012-04-25T10:25:08.707 に答える