So guys, I'm very new to Java and I have just developed my algorithm of opening forms. However, I've also recently read about singleton pattern. I don't know how Java works internally but I want to ask an expert's advice.
Is this implementation efficient? Compare it with singleton. How good or bad is it?

In my Main class, I have this:

private JFrame window;

     public static void open(JFrame window){
        this.window.setVisible(false);
        this.window = window;
        this.window.setVisible(true);
    }

In the calling class, I do this:

Main.open(new FormName());

What is the purpose of this code?
It won't work as posted because of static/non-static problems.
There is no this in the open method.

My bad, I forgot to update the code. The method is not static.
The purpose of the code is to link two forms. In HTML, you link pages with href, I'm hoping to have the same logic with this code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.