Smitha, if you were to simply try out a couple of examples you'd see what happens.
Consider:
If this code is used as an applet, to the console it would display:
constructorinitstartpaint If this same code were run as an application (
java TestProgram), then it would display:
mainconstructor Good Luck.