On 2/5/2013 12:51 PM, Stefan Ram wrote:
> Eric Sosman <> writes:
>>> Maybe someone can come up with an SCSE where a singleton is needed.
>> Runtime.getRuntime().exit(0);
>
> The library (Java SE) could have been defined to allow:
>
> class Main
> { public static void main( final java.lang.Runtime runtime )
> { runtime.println( runtime.getArgc() + " command-line arguments." );
> runtime.exit(); }}
>
> or - with less changes to the current state of Java - to allow:
>
> Runtime.exit( 0 );
A singleton class can be transformed into an uninstantiable
class having only static methods. An uninstantiable class with
only static methods can be transformed into a singleton class.
The two designs are duals: Why should one be deprecated and the
other preferred?
If all-static vs. singleton is the most pressing problem
someone faces, he has an easy life indeed!
--
Eric Sosman
d