The Artima Developer Community
Sponsored Link

Java Answers Forum
exercise 11 Bruce Eckel chapter 4

3 replies on 1 page. Most recent reply: Mar 11, 2004 5:29 PM by Paul Smith

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 3 replies on 1 page
Walter Rieppi

Posts: 5
Nickname: walter2004
Registered: Mar, 2004

exercise 11 Bruce Eckel chapter 4 Posted: Mar 10, 2004 12:58 AM
Reply to this message Reply
Advertisement
I am a newbie in Java. I making exercise with Eclipse. I don't konw how write the method finalize in a generic class.
If i write in this way
void finalize ()
{
etc .........
etc ..........
}
the Eclipse generate an error. Anyone can help me to write in the correct way how can write a finalize method inside a generic class ????
Thanks


James Tikalsky

Posts: 12
Nickname: jt2190
Registered: Dec, 2003

Re: exercise 11 Bruce Eckel chapter 4 Posted: Mar 10, 2004 9:51 AM
Reply to this message Reply
Can you compile the code from the command line, using javac?

Walter Rieppi

Posts: 5
Nickname: walter2004
Registered: Mar, 2004

Re: exercise 11 Bruce Eckel chapter 4 Posted: Mar 11, 2004 12:11 AM
Reply to this message Reply
I need to use Eclipse because we use this tool to develop Java program. This is all.
Walter

Paul Smith

Posts: 1
Nickname: pls198
Registered: May, 2003

Re: exercise 11 Bruce Eckel chapter 4 Posted: Mar 11, 2004 5:29 PM
Reply to this message Reply
It is complaining because you are trying to change the visibility of the method. In the super (java.lang.Object) it is declared as protected so you have to declare with more visibility, which means protected or public.

So if you do,

protected void finalize() throws Throwable
{
    super.finalize();
}


it should work.

BTW Eclipse can do this for you, take a look at Source -> Override/Implement Methods

Paul

Flat View: This topic has 3 replies on 1 page
Topic: Exercises from Eckel chapter 4 Previous Topic   Next Topic Topic: commit() and rollback() problem!

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use