Null pointer Exception

Hi everyone,

Please help me solve this problem. I have no idea why is this exception coming. i have pasted the code here. the code compiles then i get an error saying - startApp threw an exception, Null pointer exception

publicclass MessageDigestextends MIDletimplements CommandListener{

private Command exitCommand;

private Command enterCommand;

private TextBox t;

private Form form;

private Display display;

public MessageDigest(){

display.getDisplay(this);

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

enterCommand =new Command("Enter",Command.OK,1);

form =new Form("Message Digest");

form.addCommand(exitCommand);

form.addCommand(enterCommand);

form.setCommandListener(this);

}

publicvoid startApp()throws MIDletStateChangeException{

display.setCurrent(form);

}

publicvoid destroyApp(boolean unconditional){}

protectedvoid pauseApp(){}

publicvoid commandAction(Command c, Displayable s){

if(c==exitCommand){

destroyApp(false);

notifyDestroyed();

}elseif(c==enterCommand){

long dateTime = 28345;

MD5.msgDigest(dateTime);//calling another class file MD5.java

System.out.println(dateTime);

}

}

}

Thanx

[2861 byte] By [u4unnia] at [2007-10-2 5:25:51]
# 1
try this public MessageDigest() {display = Display.getDisplay(this);//...}kari-matti
kari-mattia at 2007-7-16 1:27:39 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 2
Hi, everyoneI solved the problem myself. quite silly indeed, i didnt assign the variable display = Display.getDisplay(this);Thanx anyways
u4unnia at 2007-7-16 1:27:39 > top of Java-index,Java Mobility Forums,Java ME Technologies...