First, you should define a Displayable object and set it as current Display for your MIDlet, with the Display setCurrent() method.
Secondly, you should perform low level graphics paint operations within Canvas paint() method, whose argument is the Graphics instance you're trying to use in your code.
For example you can extend Canvas this way:
And then, in your MIDlet startApp() method, you can do:
public class MyCanvas extends Canvas
protected void paint(Graphics g)
g.drawString("welcome to the Matrix", 10, 10, Graphics.BOTTOM | Graphics.RIGHT);
Hope it helps