Tag: his pre str [] exits the static ring name recycle
System.GC () and the garbage collection mechanism before the closure method: Finalize (the closure mechanism)
When the program exits, a finalize method is called for each object, and the ending method before garbage collection
System.GC () garbage collection method
Class Person{private int age;private string name;public person (int age, String name) {this.age = Age;this.name = name;} Public String toString () {return name: "+this.name+", Age: "+this.age;} @Overridepublic void Finalize () throws Throwable {//TODO auto-generated method stub//super.finalize (); System.out.println ("I'm screwed, I'm recycled ... ("+this+") ");}} public class SystemDemo2 {public static void main (String args[]) {Person PR = new person (110, "Zhang San");//dereference PR = null;//Force garbage Recycle System.GC ();}}
JAVA:SYSTEM.GC () and garbage collection mechanism finalize