aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes preferences in JDK1.4 Tutorial Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "preferences in JDK1.4 Tutorial" Watch "preferences in JDK1.4 Tutorial" New topic
Author

preferences in JDK1.4 Tutorial

alex earnshaw
Ranch Hand

Joined: Nov 05, 2001
Posts: 60
Hi all,
I've been looking at this book by Greg Travis in preparation for the SCJP 1.4 (whenever it comes online)
In the Preferences chapter (section 10.4.2 page 311) there is a code fragment:

I have tried compiling this fragment by putting it in the constructor of a test class (PrefsTest), and got the error:

Does anyone know anything about the new preferences API. From the error it seems you cannot use 'this' as an argument...can anyone explain?
Thanks
Alex
Bonnie Beach-Morin
Greenhorn

Joined: Jun 13, 2002
Posts: 13
From the looks of the API, that method requires a java.lang.Class class. Unless Class is a superclass of your class, passing this will cause a compile-time error. Try using


SJCP2
Bonnie Beach-Morin
Greenhorn

Joined: Jun 13, 2002
Posts: 13
Or try

for that matter.
alex earnshaw
Ranch Hand

Joined: Nov 05, 2001
Posts: 60
Originally posted by Bonnie Beach-Morin:
Or try

for that matter.

That works fine, thanks
It must be an error in the book
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: preferences in JDK1.4 Tutorial