Tutorial
Tutorial
12.12.2024
1. Design a class diagram for online journal publication and management system.
2. Write a Java class to restrict only one instance of the class at a time. Implement all possible ways to do the
above said task?
Note:
▪ The class must be accessible to clients.
▪ The class should not require parameters for its construction, as input parameters are a sign that multiple
different versions of the class are created – this breaks the most important rule, i.e. that “there can be only
one”.
20.12.2024
1. Implement a thread safe singleton design pattern for the class printspooler.
2. Implement the participants of Factory method
● Product (Page)
o defines the interface of objects the factory method creates
● ConcreteProduct (SkillsPage, EducationPage, ExperiencePage)
o implements the Product interface
● Creator (Document)
o declares the factory method, which returns an object of type Product.
Creator may also define a default implementation of the factory
method that returns a default ConcreteProduct object.
o may call the factory method to create a Product object.
● ConcreteCreator (Report, Resume)
o overrides the factory method to return an instance of a
ConcreteProduct.