Compile Error

Report a typo
public void createMenu() {                              // 1
    JMenuBar menuBar = new JMenuBar();                  // 2
    JMenu fileMenu = new JMenu("File");                 // 3
                                                        // 4
    JMenuItem newMenuItem = new JMenuItem("New");       // 5
    JMenuItem exitMenuItem = new JMenuItem("Exit");     // 6
                                                        // 7
    fileMenu.add(newMenuItem);                          // 8
    fileMenu.createSeparator();                         // 9
    fileMenu.add(exitMenuItem);                         // 10
                                                        // 11
    menuBar.add(fileMenu);                              // 12
    setJMenuBar(menuBar);                               // 13
}

One of the lines in the above code creates a compile error. Write that line number as the answer.

Enter a number
___

Create a free account to access the full topic