• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Yucca Nel
Ranch Hand
Posts: 147
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
/**
* 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?
 
Yucca Nel
Ranch Hand
Posts: 147
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No one can answer this?
 
Roel De Nijs
Sheriff
Posts: 9790
101
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic