Question:

Which method is used to display output of an applet?

Show Hint

The `paint(Graphics g)` method is the core of all drawing in AWT and Swing (where it's `paintComponent`). Whenever the system decides a component needs to be redrawn, it calls this method. You should never call `paint()` directly; instead, you call `repaint()` to request a redraw.
Updated On: Jul 2, 2026
  • show()
  • run()
  • paint()
  • print()
Show Solution
collegedunia
Verified By Collegedunia

The Correct Option is C

Solution and Explanation

Java Applets are small Java programs that are designed to be embedded in a web page. They use the AWT (Abstract Window Toolkit) for their graphical user interface.
The life cycle and drawing of an applet are controlled by the browser or applet viewer. When the applet's display area needs to be drawn or redrawn, the AWT framework calls the `paint()` method of the applet.
The `paint()` method has the signature `public void paint(Graphics g)`. You override this method in your applet class to perform all drawing operations, such as drawing text, shapes, and images, using the provided `Graphics` object.
Let's look at the other options:
(A) `show()`: A method to make a component (like a `Frame` or `Dialog`) visible, but not the primary drawing method.
(B) `run()`: The main method for a `Thread`, not for applet drawing.
(D) `print()`: A general-purpose method for printing, often associated with `System.out` or printing to a printer, not for displaying graphics in an applet.
Therefore, the `paint()` method is used to display output in an applet.
Was this answer helpful?
0
0