FCPS 2013
Java API Scavenger Hunt
Name ________________________________
1) What is the lowest common ancestor of JButton, JLabel, and JTextField?
_______________________
2) How many methods does the ActionListener interface specify?
_________________________
3) What package is ActionEvent in? _________________________
4) How many classes extend JButton? __________________
5) How many constructors does JButton define? _________________________
6) How many methods does JButton define? _________________________
7) JButton has a setText() method. Why is it not a good idea to use a button's
setText() in the middle of a program?
8) How many constructors does JTextField define? _________________________
9) Write the code to instantiate a JTextField with "Enter name" in the field, and the
field is 20 spaces wide.
10) How many fields does the System class define? _________________________
11) In System, what type of object is returned by the field “out”?
_______________________
12) If you need to program a button to quit your GUI program, what method do you
call? _________________
13) ActionListener is a(n) _________________________.
14) actionPerformed() is a method in ActionListener that your code must
________________________.
15) Math is a(n) _______________ which is full of ________________ methods.
16) If you needed a value for π in a Java program, how would you get it?
_________________________
17) If you wanted to generate a random number, what method would you call?
______________________
18) Which Math class method takes an argument in degrees and returns a value in
radians? _____________
19) What class does the Integer class extend? _________________________
20) What kind of argument does the method parseInt() require in the version that
requires only a single argument? _________________________
21) What kind of value does the method parseInt() return?
_________________________
22) How many constructors does the Double class define?
_________________________
23) What is the second field listed in the Double class?
_________________________
24) How many interfaces does JPanel implement? _________________________
25) How many constructors does JPanel define? _________________________
26) How many methods does JPanel define? _________________________
27) From what class is the paintComponent method inherited?
_________________________
28) What is the superclass of Graphics? _________________________
29) How many known subclasses does Graphics have?
_________________________
30) How many overloaded drawImage methods does Graphics define?
_________________________
31) How many arguments does the drawLine method require?
_________________________
32) Why can’t you create a Graphics object? _________________________
33) Why should you not use the method getClipRect?
_________________________
34) What package is Color in? _________________________
35) What package is Color’s superclass in? _________________________
36) What is the type of every field that Color defines?
_________________________
37) How many constructors does Color define? _________________________
38) How many static methods does Color define? _________________________
39) How many void methods does Color define? _________________________
40) How many static methods does String define? _________________________
41) How many void methods does String define? _________________________
42) How many static methods does Object define? _________________________
43) How many void methods does Object define? _________________________
44) What package is ImageIcon in? _________________________
45) What interface that begins with the letter ‘I’ does ImageIcon implement?
_______________________
46) How many methods does Icon specify? _________________________
47) What is the return-type of the method getIconWidth?
_________________________
48) How many arguments does the method getIconHeight require?
_________________________
49) How many direct known subclasses does Component have?
_________________________
50) How many direct known subclasses does Container have?
_________________________
51) How many direct known subclasses does JComponent have?
_________________________
52) How many known implementing classes does ActionListener have?
_________________________
53) What package is ActionListener in? _________________________
54) How many fields does the Math class define? _________________________
55) How many constructors does the Math class define?
_______________________
56) How many non-static methods does the Math class define?
_________________________
57) How many void methods does the Math class define?
_________________________
58) How many no-argument methods does the Math class define?
_________________________
59) What is the superclass of Integer? _________________________
60) How many interfaces does Integer implement? _________________________
61) How many constructors does Integer define? _________________________
62) How many direct known subclasses does Number have?
_________________________
63) Why can’t you create a Number object? _________________________