Slide 3.9: Line-by-line anatomy of HelloMIDlet.java (cont.)
  Slide 3.11: Line-by-line anatomy of HelloMIDlet.java (cont.)
  Home


Line-by-line Anatomy of HelloMIDlet.java (Cont.)


private Command cmdExit;
The class javax.microedition.lcdui.Command is a construct that encapsulates the semantic information of an action.

public HelloMIDlet( ) {
The purpose of a constructor is to initialize the instance variables of a newly instantiated object. The J2ME Application Manager (JAM) is responsible for installing, running, and removing MIDlets from the handheld devices. When a user chooses to run a MIDlet, it is the JAM that creates an instance of the MIDlet class and runs methods on it. The sequence of methods that will be called in the MIDlet subclass is defined by the MIDlet life cycle, which is shown below:


The application manager calls methods in the MIDlet to signify changes from one state to another. startApp( ), pauseApp( ), and destroyApp( ) are the three life-cycle methods that every MIDlet must define.