my dog learned polymorphism*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Andrews SCJD book. Is this an error in source code? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Andrews SCJD book. Is this an error in source code?" Watch "Andrews SCJD book. Is this an error in source code?" New topic
Author

Andrews SCJD book. Is this an error in source code?

Yucca Nel
Ranch Hand

Joined: Nov 20, 2008
Posts: 147

/**
* A structure that keeps track of the locked Dvd records. Note that we
* have not made this static, as doing so would mean that only one set
* of reservations could exist at any given time. We rely on the class
* which uses this ReservationManager to ensure that only one instance
* exists for any reservations.
*/
private static Map<String, DvdDatabase> reservations
= new HashMap<String, DvdDatabase>();


He says that it is not static. Yet it is? Is it meant to be static or not? I would guess static is what we are going for?


SCJP 6.0, SCJD (400/400), SCBCD for JEE 5, SCWCD 1.4 I do videos for development at
http://www.youtube.com/user/thejartender?feature=mhee
I am probably the only developer ever to have had an orange sized brain tumor in my brain while learning development!!
Yucca Nel
Ranch Hand

Joined: Nov 20, 2008
Posts: 147

No one can answer this?
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 4926
    
  10

I believe it's meant not to be static, like said in the comment.

in DvdDatabase there is following code:


Here it's static, so just one instance of ReservationsManager and thus also from the reservations-map. so no static is needed in front of the reservations-map.


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Andrews SCJD book. Is this an error in source code?
 
Similar Threads
The ReservationsManager Class In Monkhouse Book
Why Denny's DVDs DvdFileAccess.database is not static?
SCJD Exam with J2SE 5, Second Edition
static vs non static Map for lockCookie
Lock and unlock implementation in business level