Reinforce the singleton pattern

  • 8
  • Locked
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.
Comments (2)
  • Popular
  • New
  • Old
You must be signed in
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 17 , Amsterdam
31 May, 11:11
What do you mean? It worked perfectly here. Can you tell us which item in Effective Java you mean?