也谈谈Java的垃圾收集(garbage collection)
垃圾收集是Java语言非常显著的特点,不像C语言那样,老是要考虑什么数字的越界什么的。什么是垃圾(garbage)呢?“An object is considered garbage when it can no longer be reached from any pointer in the running program.”首先要了解一下内存的分配:静态分配( Static Allocation ):静态变量和全局变量的分配形式。自动分配( Automatic Allocation ):存