Multiple Choice
The code below will not compile successfully unless the argument to the makeMenuItem method is final. Why not?
Public JMenuItem makeMenuItem(final String menuLabel)
{
JMenuItem mi = new JMenuItem(menuLabel) ;
Class MyMenuListener implements ActionListener
{
Public void actionPerformed(ActionEvent
A) JMenuItem labels must be final
B) This prevents the menuLabel argument from being modified
C) Because a local variable is being accessed from an inner classes
D) Because the String class is final
E) {
DoSomethingElse() ;
System.out.println(menuLabel) ;
}
}
Mi) addActionListener(new MyMenuListener() ) ;
Return mi;
}
Correct Answer:

Verified
Correct Answer:
Verified
Q1: To create a _ layout, you supply
Q7: Consider the following code snippet:<br>Public class MyMouseListener
Q9: Consider the following code snippet:<br>Class MyListener implements
Q17: What is the default layout manager of
Q19: Which layout manager constructor call would be
Q27: Which layout manager may change the location
Q29: Suppose listener is an instance of a
Q36: Which class has constants called NORTH and
Q41: Which component can generate action events?<br>I JMenuBar<br>II
Q48: A _ is a combination of a