Hi,
I am preparaing for the OCMJD exam and I read Andrew Monkhouse and Terry Camerlengo's book (
SCJD Exam with J2SE 5 platform second edition) . I read and run their source code and I have a few questions that I'd like you to answer please. Source code follows.
1- If the member class ReservationsManager and DvdFileAccess are already declared as static in the DvdDatabase class, do we really need to declare ReservationsManager member classes and DvdFileAccess member classes static again ( I am talking about private static Map<
String, DvdDatabase> reservations, private static Lock lock, private static Condition lockReleased for class ReservationsManager and private static Map<String, Long> recordNumbers, private static ReadWriteLock recordNumbersLock, private static String emptyRecordString, private static String dbPath for class DvdFileAccess) ? Isn't it redundant ( I am not a
java expert, that's why I am asking) ? Shouldn't they all just be private only with no static attribute? If not, which member should remain static ?
Below the source code for the Database class as it appears in the book's source code :
Below the source code for the ReservationsManager class as it appears in the book's source code :
Below the source code for the DvdFileAccess class as it appears in the book's source code :
Thanks for your help.
Sincerely,
borkev