Quote:
Originally Posted by Vincent
Hi
On page 10, Chapter 1 the very first Java code MyFirstApplet it will run on Eclipse but not with Netbeans or Notepad ,the reason cited is the program doesn't have a main method and recommends changing the method from public void paint to public static void main (String args [])
Why does it run on Eclipse then and not the others 
|
The reason why the notepad version of your program generates error is because you didnt define main() as static.
What static does is it tells javac and java that hey, even though the class does not have any objects you are still supposed to compile/execute this method.
And it makes sense to have main() as a static method because all your objects that are created are created within the main() method. So you must be able to execute main() even though there are no objects.
and just imprint it in your head main() will always be
Code:
public static void main(String[] args)