Multiple Choice
What is wrong with the following code?
Class ExitListener implements ActionListener
{
Public void actionPerformed(ActionEvent event)
{
System.exit(0) ;
}
}
ActionListener exitListener = new ExitListener() ;
JMenu exitMenu = new JMenu("Exit") ;
ExitMenu.addActionListener(exitListener) ;
JMenuBar menuBar = new JMenuBar() ;
MenuBar.add(exitMenu) ;
A) The ExitListener class is not public
B) You cannot attach a listener to a menu, only to a menu item
C) You cannot add a menu to the menu bar, only a menu item
D) You need to use a menu listener, not an action listener
Correct Answer:

Verified
Correct Answer:
Verified
Q5: Suppose a JPanel with a BorderLayout manager
Q8: When adding a component to a container
Q11: What can be determined about obj from
Q31: Which component can be added to a
Q62: If one ChangeListener is listening for three
Q71: Which GUI element allows text entry from
Q74: Consider the following code snippet:<br>Final RectangleComponent component
Q76: If the method makeMenuItem is called four
Q79: A(n) _ is used to capture mouse
Q80: Consider the following code snippet:<br>Class MouseClickedListener implements