Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

What is importance of EventQueue.invokeLater(new Runnable() ...

807589Aug 22 2008 — edited Aug 22 2008
I have noticed that there seems to be two styles of implementing the main method within a class. I have included the following code as a reference to my question. Style A being the default approach and Style B being a rather more preferred approach. I am curious as to what exactly is the difference between the two? What advantages does one have over the other?
//Style A
public static void main(String[] args) {
     //Code...
}

//Style B
public static void main(String[] args) {
     EventQueue.invokeLater(new Runnable() {
          public void run() {
               new myClass().methodName();
          }
     });
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 19 2008
Added on Aug 22 2008
3 comments
1,455 views