Tuesday, June 10, 2008

Java 2 Micro Edition - Case Study

Extending one’s knowledge of Java to J2ME is very easy. Every program in J2ME is called a midlet and extends from the midlet class. Here is a sample program in NetBeans using the CLDC configuration and the MIDP 2.0 profile.

As evident from the screen-shots, the constructors in both the programs are very much similar. A few differences exist in the both such as the import statements in J2ME where two packages - midlet and lcdui are imported. Further an alert object is constructed to display the message.

Three important functions are present in every J2ME program. They are -

startApp Called whenever the application is started
pauseApp Called whenever the application is paused
destroyApp Called whenever the application is terminated