HelloWorld:(

rainver rainver 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
谁能给个HelloWorld程序啊?
这个编译通过了但是在模拟器里显示有问题,点launch时抛出null Exception
java.lang.NullPointer Exception
我用的是jdk1.4.2和wkt1.0.4运行示例程序没有问题,不会是配置错了吧??

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

public class HelloWorld extends MIDlet implements CommandListener
{
private Display display;
private Form props;

private Command exitCommand = new Command("Exit", Command.EXIT, 1);

public HelloWorld()
{
display = Display.getDisplay(this);
}

public void startApp()
{
props = new Form("Hello World");
props.append("Hello World!\n");

props.addCommand(exitCommand);
props.setCommandListener(this);
display.setCurrent(props);
}

public void commandAction(Command c, Displayable s)
{
if (c == exitCommand)
{
destroyApp(false);
notifyDestroyed();
}
}

public void destroyApp(boolean unconditional)
{
}

public void pauseApp()
{
display.setCurrent(null);
props = null;
}

}
各位帮帮忙,谢谢了先:)
...全文
评论 3
收藏 已收藏
分享
返回顶部
rainver
J2ME 13,096 成员 26,491 内容