和有什么区别
Runtime.exit(0) 和 System.exit(0)
同样之间有什么区别
Runtime.gc() 和 System.gc()
什么时候用哪个?
System.Xxxx 更短。Runtime.Xxxx() 不能直接使用。
和有什么区别
Runtime.exit(0) and System.exit(0)
没有任何。
同样之间有什么区别
Runtime.gc() and System.gc()
没有任何。
什么时候用哪个?
由于没有区别,因此选择纯粹是装饰性的。
看看javadocs:http ://docs.oracle.com/javase/1.5.0/docs/api/java/lang/System.html#exit(int )
“调用 System.exit(n) 实际上等同于调用:Runtime.getRuntime().exit(n)”