Java: Creating a new instance of the UI class
<p>I have two classes: class A and class B. class A has a main method. Class B is the User Interface (JFrame). I want to have an instance of B in A, but when I write any of the following the program runs but no window shows:</p>

<pre><code>public class A{
    static B d= new B();
        public static void main(String args[]){
                           d.setVisible(true);} }



public class A{
        public static void main(String args[]){
         java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new B().setVisible(true);
            }
        });
        }}


public class A{
            public static void main(String args[]){
             B d= new B()
             d.setVisible(true); 
            }}
</code></pre>

<p>How can I show the window?</p>
