Session 12 |
Tasks (to be submitted by Wed 01.05 23:55) 1 point
Task 1.
Create a class called IDRegister
. The class should contain List<String>
which holds personal identification numbers and the method register
which adds a personal identification number to the list if it is not there yet. In addition, the program has to implement index
method that returns the index of a personal identification number in the list or -1 if the personal identification number is not registered. Use synchronization so that the registry list is protected against the race. Use the list as a monitor.
Create the client class to demonstrate the work of threads.
Session 12 |