This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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
 
 
subject: preferences in JDK1.4 Tutorial
 
Similar Threads
The application requester cannot establish the connection. (Too many open files)
Add application to start up
Another Design Question
how to stop the database connection immediately when i click the "cancel" button .
Stable Marriage Problem