Question
Answer below questions about the Singleton: (2 points) One of the limitations of Singleton is sub classing any class can subclass the Singleton class and
Answer below questions about the Singleton: (2 points) One of the limitations of Singleton is sub classing any class can subclass the Singleton class and thus have access to its own instance because of inheritance sub class inherit the parent class , what do you think of this? Consider the following code to answer the following question: public class PrintDriver { private static final PrintDriver INSTANCE = new PrintDriver(); private PrintDriver() {} public static PrintDriver getInstance() { return INSTANCE;} } (2 point) which type of initialization is used in the code? What is issue of this type of initialization? (2 points) Is the singleton in the above code thread-safe? Explain your answer? (4 points) Rewrite the code to make it thread-safe using double-check locking?
Hasan sent Today at 9:22 AM
-You are implementing a simple file system for an operating system for managing files and folders; similar to Windows or UNIX. Your design should follow the following guidelines i) The entire file system is represented by an object which is the reference to the root folder ii) Any folder in the file system may contain two types of items, folders (subfolder) and files and you want to treat both in the same way iii) possible operations: getName, getPermission, listItem (1 point) What is the most appropriate design pattern? (3 points) Draw the class diagram, and make it clear what are the main components and what are their roles, and show the relationship between classes? (6 points) write code of the main components in your design?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started