Over a million developers have joined DZone.

J2ME - HelloWorld

DZone's Guide to

J2ME - HelloWorld

Free Resource
// Example Hello World Java MicroEdition

import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Form;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;

public class HelloJ2ME_a1 extends MIDlet
	private Display mDisplay;
	private Form mForm;
	protected void startApp() throws MIDletStateChangeException
		if(mForm == null)
			// Creo il Form dove inserire il messaggio (questo puo' essere pensato come ad un JFrame)
			mForm = new Form("Hello J2ME !!!");
			// Ottengo un Display per la MIDlet
			mDisplay = Display.getDisplay(this);
		// Imposto il Form corrente nel Display

	protected void pauseApp()


	protected void destroyApp(boolean arg0) throws MIDletStateChangeException
		// Notifico alla JVM della morte della MIDlet (viene chiamato il Garbage Collector)

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}