Question: I have a simple Java theory question. If I write a class that contains a main() method along with some other methods, and within that main method invoke an instance of the class (say new Class()), I'm a bit confused why a recursion doesn't occur. Let's say I'm writing a graphing program, where the other methods in the class create a window and plot data; in the main method I call an instance of the class itself, and yet only one window appears. That's great, and it's what I wanted, but intuition suggests that if I create an instance of a class from within itself, some sort of recursion should occur. What prevents this? Here is an example (in my mind, I'm wondering what prevents unwanted recursion):

```
     public class example{
         method1(){create Jpane}
         method2(){paint Jpane}
         method 3(){do some computations}

         public static void main(String[] args){
            new example(); // or create Jblah(new example()); 
         }
      }

```

Answer: 
I think you're confusing the `main` method - which is just the entry point of the program - with a *constructor*.

For example, if you wrote:

```
public class Example {
    public Example() {
        new Example(); // Recursive call
    }

    public static void main(String[] args) {
        // Will call the constructor, which will call itself... but main
        // won't get called again.
        new Example(); 
    }
}

```

Then that *would* go bang.
The `main` method does not get executed automatically when you instance a class. It simply can be used as an entry point to an application - and then will be executed once.