What will happen when you compile and run the following program?
import java.awt.*;
public class X
{
public static void main(final String[] args)
{
final Frame f = new Frame();
final Panel p = new Panel();
p.add(new Button("east"), BorderLayout.EAST);
p.add(new Button("center"), BorderLayout.CENTER);
p.add(new Button("west"), BorderLayout.WEST);
f.add(p);
f.pack();
f.setVisible(true);
}
}
A) A compilation error.
B) A frame with one button.
C) A frame with 3 buttons in a row. From left to right: west, center, east"
D) A frame with 3 buttons in a row. From left to right: east, center, west"
E) An empty frame with no button.