Cleanup: finalization (finialize()) and garbage collection
- Your object might not get garbage collected
- Garbage collection is not destruction
- Garbage collection is only about memory
Force garbage collection:
System.gc();
use of finalize:
protected void finalize(){
if(some conditions)
errorMessage;
}
Array
int[] a;
Random rand = new Random(47);
a = new int[rand.nextInt(20)];
Inner Class
inner class and surrounding class
public class Parcel1 {
class Contents { //protected, also can be + -;
private int attribute;
public int method() { return 0; }
}
OuterClassName.InnerClassName
Out.Inner inner = out.getInner();
In addition, inner classes have access rights (link) to all the elements in the enclosing class. (different from C++ which does not have links)
done
No comments:
Post a Comment