All Exams Test series for 1 year @ ₹349 only
Question

Arrange the following applet life cycles methods in sequence 

A. start() 

B. paint() 

C. init() 

D. stop() 

Choose the correct answer from the options given below:

The correct answer is
C, A, B, D

Applet Life Cycle Method Sequence

Java Applets follow a specific life cycle sequence managed by the runtime environment. Understanding this order is essential for applet programming.

Applet Method Execution Order

The methods provided represent key stages in an Applet's life:

  • C. $init()$: Executed once when the applet is first loaded. Used for initial setup.
  • A. $start()$: Called after $init()$ and also when the applet resumes execution. It begins or restarts the applet's activity.
  • B. $paint(Graphics g)$: Called after $start()$ and whenever the applet needs to be redrawn. It handles the visual output.
  • D. $stop()$: Called when the applet is paused or the user navigates away. It halts the applet's activity.

Determining the Correct Sequence

The logical and standard execution order for these methods is:

  1. Initialization: $init()$ (C)
  2. Starting Execution: $start()$ (A)
  3. Displaying Content: $paint()$ (B)
  4. Stopping Execution: $stop()$ (D)

Therefore, the correct sequence is C, A, B, D.

Was this answer helpful?

Important Questions from Java

  1. Which of the following statement(s) is/are TRUE regarding Java Servelets?

    (a) A Java Servlet is a server-side component that runs on the webserver and extends the capabilities of a server.

    (b) A Servelet can use the user interface classes like AWT or Swing.

  2. What is the output of the following JAVA program?

    class Test

    {

    public static void main (String [ ] args)

    {

    Test obj = new Test ();

    obj.start ();

    }

    void start ()

    {

    String stra="do”;

    String strb = method (stra);

    System.out.print(“:” + stra + strb);

    }

    String method (String stra)

    {

    stra=stra+”good”;

    System.out.print (stra);

    return “good”;

    }

    }

  3. A java program that is embedded in HTML document and runs in the context of java capable browser is known as ______.

  4. JAVA compiler translates source code into _______.

  5. Which of the following statement(s) is/are correct regarding java programming?

    I. Place a semicolon immediately after a method header

    II. Define a method outside the braces of a class definition

Need Expert Advice?

Start Your Preparation with Prepp Mobile App

Download the app from Google Play & App Store
Download the app from Google Play & App Store
Prepp Mobile App