Reinforce the singleton pattern

  • 8
  • unavailable
Let's delve into the singleton pattern by considering the sun and planets of the solar system. First, do an Internet search and find some example of "lazy initialization" using the singleton pattern. Create three singleton classes "in its likeness and image": Sun, Moon and Earth. Then implement the Planet interface in them. And do a couple other operations.
You can't complete this task, because you're not signed in.
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Ulan MukanbetovLevel 26 , Bishkek
18 August, 09:02
that rare moment when you proud of yourself )))
David LavigneLevel 19 , Lynnwood
1 April, 17:29
If you are going to have students google a solution, then your validator should be able to handle one of the most common singleton implementations such the Instance Holder solution outlined in "Effective Java". If that is too much work, you might want to refactor this question to not prompt the student to find other solutions.
AhmedLevel 19 , Amsterdam
31 May, 11:11
What do you mean? It worked perfectly here. Can you tell us which item in Effective Java you mean?