I would really appreciate it if someone could help explain the answers to the following.
--------------------------------------------------------------
1.What will be the appearance of an
applet with the following init() method?
public void init() {
add(new Button("hello"));
}
A]nothing appears in the applet
B]a button will cover the whole area of the applet
C]button will appear in the top left corner of the applet
D]button will appear centred in the top region of the applet
E] button will appear in the center of the applet
--------------------------------------
3.Given the following code, which code fragments, when inserted at the indicated location, will succeed in making the program display a button spanning the whole window area?
import java.awt.*;
public class Q1e65 {
public static void main(
String args[]) {
Window win = new Frame();
Button but = new Button("button");
// insert code fragment here
win.setSize(200, 200);
win.setVisible(true);
}
}
A]win.setLayout(new BorderLayout()); win.add(but)
B]win.setLayout(new GridLayout(1,1)); win.add(but)
C]win.setLayout(new BorderLayout());win.add(but,BorderLayout.CENTER)
D]win.add(but):
Ewin.setLayout(new FlowLayout()); win.add(but)