Skip to content
Advertisement

Best way to create singleton array

What is the “easiest” way for you to create a singleton (with exactly one element) Objects array in Java ?

Advertisement

Answer

Object [] singleton = { new SomeObject() };
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement