keyword this + finalize method + System.gc()

We are currently on Chapter 9 - Inheritance in my CIS 201 class at school. There were three new things introduced in the last part of the chapter, all of which I have yet to grasp. Inheritance was smooth ... but I don't understand

#1) Keyword 'this' ... what its used for, the difference between an implict and explicit use ... why you even would want to use it, etc.

#2) Garbage collection ... I understand the need to free up memory. By marking data members as 'null', that is just like marking them as ready to be collected by the garbage collector, correct? Does System.gc() then go and gather the members that are marked as 'null' , or how does that work?

#3) What is the point in a 'finalize' method? In my textbook, a finalize method always has "super.finalize()" a method call to the superlcass's finalize method. I don't understand why this is so.

Also ... are any of the concepts that I am asking about too generic/textbook? I know some of the concepts that my book teaches me are for fundamentals and just the knowledge of it, even though you don't really use some of it in industry. Are any of the concepts I am asking about simliar to this, or are they very important?

Anyone that could give me a good description that will allow me to atleast understand the concept of each would be great. I am not asking for no book or novel by no means. Also, remember that I am in an intro class to Java :) I am not caught up with 99.9 % of you.

Thanks for the help, and hope everyone has a great Thanksgiving.

- Rusty Rothwell

[1589 byte] By [Rusty] at [2007-9-30 23:04:03]
# 1

#1) Keyword 'this' is used to access the current object's attributes/methods.For example if you have overridden methods in two classes, if you want to use a particular class's method with in its someother method we can use 'this.method()' . This is the case with Attributes also.

#2) In java Garbage collector will collect the objects once their scope is over.

#3) finalize() method is the last method executed before the object is Garbage collected.It s kind of destructor (opposite to constructor)

nrajasekhar at 2007-7-7 13:37:26 > top of Java-index,Administration Tools,Sun Connection...