Win a copy of Machine Learning for Business: Using Amazon SageMaker and JupyterE this week in the Jython/Python forum
or Object Design Style Guide in the Object-Oriented programming forum!
    Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

Urgent question . Please help

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
 
Ranch Hand
Posts: 3141
  • Mark post as helpful
  • send pies
  • Report post to moderator
Closing this thread. For an answer see duplicate post http://www.javaranch.com/ubb/Forum24/HTML/008926.html
------------------
Jane Griscti
Sun Certified Programmer for the Java� 2 Platform
 
An elephant? An actual elephant. Into the apartment. How is the floor still here. Hold this tiny ad:
Level Up Your Code with a Pro Java IDE
https://www.jetbrains.com/idea
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!