Multiple choice

To determine the width and height of an application, which of the following method is used?

  1. getWidthHeight()

  2. setWidthHeight()

  3. getSize()

  4. setHeightWidth()

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

The getSize() method returns a Dimension object containing both the width and height of an applet or component. There is no standard getWidthHeight() or setWidthHeight() method in the Java AWT framework - you use getSize() to retrieve dimensions and setSize() to set them.