exitCommand = new Command("Exit",Command.EXIT, 0);
myString = new StringItem("15");
myForm.append(myString);
myForm.addCommand(exitCommand);
myForm.setCommandListener(this);
}
public void startApp()
{
mDisplay = Display.getDisplay(this);
mDisplay.setCurrent(myForm);
}
public void commandAction (Command c, Displayable s)
{
destroyApp(false);
notifyDestroyed();
}
public void run()
{
}
public void pauseApp()
{
}
public void destroyApp(boolean unconditional)
{
}
}
" class="related-a">
2.
What will happen on attempting to compile and run the following code?
public class ERMidlet extends MIDlet implements CommandListener, Runnable
{
private Display mDisplay;
private Form myForm;
private Command exitCommand;
private StringItem myString;
ERMidlet()
{
myForm = new Form("Expert Rating Exam");
exitCommand = new Command("Exit",Command.EXIT, 0);
myString = new StringItem("15");
myForm.append(myString);
myForm.addCommand(exitCommand);
myForm.setCommandListener(this);
}
public void startApp()
{
mDisplay = Display.getDisplay(this);
mDisplay.setCurrent(myForm);
}
public void commandAction (Command c, Displayable s)
{
destroyApp(false);
notifyDestroyed();
}
public void run()
{
}
public void pauseApp()
{
}
public void destroyApp(boolean unconditional)
{
}
}