java.lang.Object has a finalize() method. It is similar to desctrutor in C++, but there are important differences.
finalize() is basically for release non-memory resources that the object holds reference to, like database connection, file handle, etc. In java, memory allocation/release is not an issue.
But there is no deterministic time when finalize() is called. It depends on garbage collector behavior. So you'd better don't use it.
refer the book 'effective java', itme 6 'avoid finalizers'. Hope there is a chinese version available.