A Flag inside main function
<p>Can I define a flag into my Main Function but not as static?
Here is my Code for the Main Function , and I want to use the Flag in a different class (Panel2 class) </p>

<pre><code>public class MyFrame extends JFrame 
{
    private Panel1 P1 = new Panel1();
    private Panel2 P2 = new Panel2();

    public static boolean flag = true;

    public MyFrame()
    {
        super("MyFrame");
        setLayout(new BorderLayout());
        add(P1,BorderLayout.CENTER);
        add(P2,BorderLayout.EAST);
        setSize(500,400);
        setVisible(true);
    }

    public static void main(String[] args) 
    {
        MyFrame mF=new MyFrame();
        mF.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }
}
</code></pre>
