• Post Reply 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Sun Sample question: 8

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sample question 8 from sun at the following URL
http://suned.sun.com/USA/certification/progsqwa.html


8.
1. import java.awt.*;
2.
3. public class Test extend Frame {
4. public Test() {
5. add( new Label("Hello") );
6. add( new TextField("Hello") );
7. add( new Button("Hello") );
8. pack();
9. show();
10. }
11. public static void main(String args[]) {
12. new Test();
13. }
14.}
What is the result?
A. The code will not complile.
B. A window will appear containing only a Button.
C. An IllegaArgumentException is thrown at line 6.
D. A window will appear but will not contain the Label, TextField, or Button.
E. A window will appear containing a Label at the top, a TextField below the Label, and a Button below the
TextField.
F. A window will appear containing a Label on the left, a TextField to the right of the Label, and a Button to the
right of the TextField .


Answer given is:
B.A window will appear containing only a Button.
Since on line 3, the keyword is "extend" instead of "extends",
program should not compile. Any thoughts???
 
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It doesn't compile as written, for the very reason you cited.
Marilyn
reply
    Bookmark Topic Watch Topic
  • New Topic