Question:medium

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

The Correct Option is C

Solution and Explanation

Step 1: Remember who controls an applet's drawing.
An applet does not run its own main loop the way a standalone application does, instead the browser or applet viewer decides when the applet's visible area needs to be drawn or redrawn.
Step 2: Identify the callback method that gets invoked for this.
Whenever drawing is needed, the AWT framework automatically calls the applet's paint method, which receives a Graphics object, and all drawing code for text, shapes, and images belongs inside this method.
Step 3: Eliminate the other candidate methods.
show simply makes a window visible, run belongs to threads, and print is a generic output method, none of them are the designated hook for rendering an applet's contents, which leaves paint as the correct method for displaying an applet's output.
\[ \boxed{\text{paint()}} \]
Was this answer helpful?
0