After years of Java programming I always used to create my main()
methods like this :
public static void main(String[] args)
{
runProgram();
}
But recently I studied some codes from the Web and saw this sometimes instead of the usual main()
use above :
public static void main(String[] args)
{
SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
runProgram();
}
});
}
I simply want to know :
- Why to use this instead of the usual
main()
way ? I can't see any difference when I give it a try. - What is the difference between these two ways ?
Thanks for reading me and your answers.