I have a method that fills in a file with default values and I call that method in the constructor. I want that method to run only once ( I mean by only once so when the user press the play button /in eclipse/ then that method will not run in the second press.
I have tried something like this but it doesn't work :
private boolean defaultExecuted;
public synchronized void defaultStatsFile()
{
    if (defaultExecuted)
    {
        return;
    }
    else
    {
        fileReadNWrite.configWriter("panel1", "non-US incidents");
        fileReadNWrite.configWriter("panel2", "Hoaxes");
        fileReadNWrite.configWriter("panel3", "Under NUFORC investigation");
        fileReadNWrite.configWriter("panel4", "Likliest Shape");
        defaultExecuted = true;
    }
}
Is there a smarter way to fill in a file only once ?
Please if something is not clear comment and I will reply. Any help is appreciated.
 
     
     
    