Let´s check our code and explain some concepts and after that we will try to launch our helloworld sample in a simulator. If you open the only Java class the project has, HelloWorldDemo.java you see the following:
public class HelloWorldDemo extends UiApplication
As you can see our class extends from UiApplication, which is the base class for all device applications which provide a user interface. This is because the main purpose of this helloworld class is just showing a screen with the classic text “Hello World". If you don’t need any user interface, you could extend Application, which is another base class. Of course, BlackBerry is MIDP 2.0, CLDC 1.1 compliant so you can also extend from MIDlet and create a j2me application. We will see that in future articles.
The following code will be detailed in the next few articles but at the moment, you can see that the class constructor just pushes a HelloWorldDemoScreen which extends a MainScreen object to the device Screen.
This HelloWorldDemoScreen is just a basic main screen with the text “Hello World" and a Dialog alert saying “Goodbye" which is prompted when the screen is closed.
Let’s see if it works. You just need to run your project by going to the Eclipse Run button>Run As>BlackBerry Simulator.
This will launch the default BlackBerry Simulator, which is BlackBerry 9550 Storm 2 model, with our application installed. You can find it in Menu>Downloads. If you launch it, you should see something like this: