The code will not compile
The code will compile but will throw a runtime exception
It will not display anything
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)
{
}
}
Correct Answer:
It will display 15 on the devices screen
Explanation:
Note: This Question is unanswered, help us to find answer for this one
More J2ME - Java Platform Micro Edition MCQ Questions