java.lang.System.gc()只是java.lang.Runtime.getRuntime().gc()的简写,两者的行为没有任何不同,都是垃圾回收机制。System.gc()和runtime.gc()用于提示jvm进行垃圾回收,但是否立即回收还是延迟回收由java虚拟机来决定。