import java.applet.*;
2: import java.awt.*;
3:
4: public class Q20 extends
Applet 5: {
6: Button okButton = new Button("Ok");
7:
8: public void init()
9: {
10: setLayout(new BorderLayout());
11:
12: add("South", okButton);
13: add("North", okButton);
14: add("East", okButton);
15: add("West", okButton);
16: add("Center", okButon);
17:
18: setSize(300,300);
19: }
20: }
The above Applet will display
A) Five Buttons with label "Ok" at Top, Bottom, Right, Left and Center of the Applet.
B) Only one Button with label "Ok" at the Top of the Applet.
C) Only one Button with label "Ok" at the Bottom of the applet.
D) Only one Button with label "Ok" at the Center of the Applet.
The answer for this is given to be B.
I thought the answer is A
Can someone explain ?
Thanks,
Srini
<reply>
The answer B is correct because u r not taking in consideration that u r playing with same button=OKButton.Hence u r superimposing same button with other diff buttons & inly the last 1 wiil be same.
Hope u r clear.
deepak