Exam 10: Interfaces

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

Consider the following code snippet: public static void main(String[] args) { Final Order myOrder = new Order(); JButton button = new JButton("Calculate"); Final JLabel label = new JLabel("Total amount due"); ) . . Class MyListener implements ActionListener { Public void actionPerformed(ActionEvent event) { ) . . } } } Which of the local variables can be accessed within the actionPerformed method?

(Multiple Choice)
4.9/5
(32)

What does the MouseAdapter class provide?

(Multiple Choice)
4.9/5
(32)

Consider the following code snippet: public static void main(String[] args) { Order myOrder = new Order(); JButton button = new JButton("Calculate"); JLabel label = new JLabel("Total amount due"); ) . . Class MyListener implements ActionListener { Public void actionPerformed(ActionEvent event) { Label.setText("Total amount due " + myOrder.getAmountDue()); } } } What is wrong with this code?

(Multiple Choice)
4.9/5
(37)

To use an interface, a class header should include which of the following?

(Multiple Choice)
5.0/5
(42)

Consider the following code snippet: public class Demo { Public static void main(String[] args) { Point[] p = new Point[4]; P[0] = new Colored3DPoint(4, 4, 4, Color.BLACK); P[1] = new ThreeDimensionalPoint(2, 2, 2); P[2] = new ColoredPoint(3, 3, Color.RED); P[3] = new Point(4, 4); For (int i = 0; i < p.length; i++) { String s = p[i].toString(); System.out.println("p[" + i + "] : " + s); } Return; } } This code is an example of ____.

(Multiple Choice)
4.7/5
(41)

To build a user interface that contains graphical components, the components ____.

(Multiple Choice)
4.9/5
(37)

Which statement about methods in an interface is true?

(Multiple Choice)
4.9/5
(34)

Consider the following code snippet: public class Inventory implements Measurable { ) . . Public double getMeasure(); { Return onHandCount; } } Why is it necessary to declare getMeasure as public ?

(Multiple Choice)
4.7/5
(40)

Which of the following statements about interfaces is true?

(Multiple Choice)
4.9/5
(39)

You wish to detect when the mouse is moved into a graphical component. Which methods of the MouseListener interface will provide this information?

(Multiple Choice)
4.7/5
(40)

Which of the following statements about interfaces is NOT true?

(Multiple Choice)
4.9/5
(43)

Consider the following code snippet: public class Inventory implements Measurable { ) . . Double getMeasure(); { Return onHandCount; } } What is wrong with this code?

(Multiple Choice)
4.8/5
(33)

____ can reduce the coupling between classes.

(Multiple Choice)
4.7/5
(41)

Which of the following statements about an inner class is true?

(Multiple Choice)
4.9/5
(33)

____ occurs when a single class has several methods with the same name but different parameter types.

(Multiple Choice)
4.7/5
(41)

In Java, ____ can be used for callbacks.

(Multiple Choice)
4.9/5
(43)

The ____ method should be called whenever you modify the shapes that the paintComponent method draws.

(Multiple Choice)
4.7/5
(37)

Which of the following statements about interfaces is NOT true?

(Multiple Choice)
4.7/5
(33)

To associate an event listener with a JButton component, you must use the ___ method of the JButton class.

(Multiple Choice)
4.9/5
(39)

Consider the following code snippet: myImage.add(new Rectangle(10,10,10,10)); This code is an example of using ____.

(Multiple Choice)
4.9/5
(33)
Showing 61 - 80 of 85
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)