Sams Teach Yourself Java 2 in 24 Hours

Sams Teach Yourself Java 2 in 24 Hours

By Rogers Cadenhead

Quiz

After the LottoMadness program has soured you on games of chance, play a game of skill by answering the following questions.

Questions

  1. Why are action events called by that name?
    1. They occur in reaction to something else.
    2. They indicate that some kind of action should be taken in response.
    3. They honor cinematic adventurer Action Jackson.
  2. What does this signify as the argument to an addActionListener() method?
    1. "This" listener should be used when an event occurs.
    2. "This" event takes precedence over others.
    3. "This" class of objects will handle the events.
  3. Which component stores user input as integers?
    1. JButton
    2. JTextField
    3. Neither does

Answers

  1. b. Action events include the click of a button and the selection of an item from a pull-down menu.
  2. c. If the name of another class were used as an argument instead of the this statement, that class would receive the events and be expected to handle them.
  3. c. JTextField and JTextArea components store their values as text, so their values must be converted before they can be used as integers, floating-point numbers, or other non-text values.

Share ThisShare This

Informit Network