Choice:
A Choice class implements a pop-up menu of choices. Just the current choice is visible in a Choice component. A choice can be modified through popping up the list of choices through clicking on the menu and selecting another item on the choice list.
Constructing a pop-up menu of choices includes the subsequent steps:
Creating choice object by using the single default constructor given.
Adding the items using the add( ) method.
void add(String item)
The Choice class also declares methods for inserting and removing item from the pop-up menus
// Illustrating choice
import java.awt.*;
import java.applet.*;
public class ChoiceApplet extends Applet
{
public void init ( )
{
Choice pizzaChoice = new Choice ( );
pizzaChoice.add("Large Pan Pizza");
pizzaChoice.add("Medium Pan Pizza");
pizzaChoice.add("Small Pan Pizza");
}
}