i have a proble i have made a class SingleTon .. i use it in many places in my project
.. but just have relised that the calss is creating more intances ...the code is as
following ....
public class LogManager
{
private java.io.PrintStream m_out;
private LogManager( PrintStream out )
{
m_out = out;
}
public void log( String msg )
{
System.out.println( msg );
}
static private LogManager sm_instance;
static public LogManager getInstance()
{
if ( sm_instance == null )
sm_instance = new LogManager( System.out );
return sm_instance;
}
}
and using it like this ...
LogManager.getInstance().log( "some message" );
what sud i do ??