T. Strunk T. Strunk - 9 months ago 47
Java Question

Java - Cannot find symbol of my method

I'm writing a web browser in Java..

public class Browser extends JFrame

public JPanel addressPanel, windowPanel;
public JLabel addressLabel;
public JTextField textField;
public JEditorPane windoPane;
public JScrollPane windowScroll;
public JButton addressButton;

public void WebBrowser() throws IOException

//initiate vars and print to screen

public static void main(String[] args)

WebBrowser browser = new WebBrowser();

I have simplified it a bit for the sake of my question. I am getting an error:

cannot find symbol: WebBrowser browser = new WebBrowser();

But I am not sure how to fix it and I do not understand why the method is not recognized. Any help will be very appreciated.

Answer Source

Your class is Browser. The constructor method should also be Browser and not return void.

public class Browser {

    public static void main(String [] args) {
        Browser browser = new Browser();

    public Browser() {}


Start with a Java tutorial.