HelloMIDlet的小问题
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class HelloMIDlet extends MIDlet
{
private Display display;
public HelloWorld() {
super ();
// TODO 自动生成构造函数存根
Form form = new Form( "Hello World ");
form.append( "Welcome to J2ME World! ");
Display.getDisplay(this).setCurrent(form);
}
public void startApp()
{
System.out.println( "startApp Called ") ;
Form t = new Form( "画面 ");
display.setCurrent(t);
}
public void pauseApp()
{
System.out.println( "pauseApp Called ") ;
}
public void destroyApp(boolean unconditional)
{
System.out.println( "destroyApp Called : " + unconditional) ;
}
}
错误:
Project "HelloMIDlet " loaded
Project settings saved
Building "HelloMIDlet "
C:\WTK25\apps\HelloMIDlet\src\HelloMIDlet.java:8: 方法声明无效;需要返回类型
public HelloWorld() {
^
1 错误
com.sun.kvem.ktools.ExecutionException
Build failed
修改下就给分
------解决方案--------------------出售手机游戏。QQ:779856263
------解决方案--------------------display.setCurrent(t);
还没有创建,就直接使用了,所以
空指针了