This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript 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: 5216
    
  12

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/
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Andrews SCJD book. Is this an error in source code?