static is like a swear word or curse word. It should generally not be used and, when, rarely, it is, only for a very special purpose, which you understand consciously and fully. It should NOT be used to get you out of problems that you encounter when you don't use it.

Java is an object-oriented language and shouldn't really be used at all until you understand at least the basics of OO principles. You can maybe start out at http://docs.oracle.com/javase/tutorial/java/concepts/ . Otherwise, you're just abusing the language and would be probably better off using a different one.


Until you understand the full importance of static, and OO principles, you might as well make it a rule of thumb that the keyword will appear only ONCE in your application - in the declaration public static void main(String[] args) of your app's entry point.

The following examples offer a simple but effective way of getting an app going, both without and with a GUI:

public class Foo {
    public void runMe() {
        // App's implementation starts here
    }

    public static void main(String[] args) {
        new Foo().runMe();
    }
}

And

import javax.swing.SwingUtilities;
import javax.swing.JFrame;


public class FooGui extends JFrame {
    // App's implementation starts here
    private void runMe() {
    }

    public static void main(String[] args) {
        // Per Sun recommendation, start in event dispatch thread
        try {
            SwingUtilities.invokeAndWait(new Runnable() {
                    public void run() {
                        FooGui f = new FooGui();
                        f.runMe();
                    }
                });
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}