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.
just because you have a main method in the class doesn' mean that it will be called every time you create the class. 

Java looks for main as an entry point for the program, and calls it upon startup. Any objects you instantiate from their do not call main, since as far as java is concerned, it has done its job of making the entry point to the program.