After you’ve created the Java class Spartacus.java
and compiled it successfully, you can run it within NetBeans in two ways:
• Choose Run, Run File from the menu.
• Right-click Spartacus.java
in the Projects pane, and choose Run File.
When you run a Java class, its main()
method is called by the compiler. The string “I am Spartacus!” appears in the Output pane, as shown in Figure A.4.
A Java class must have a main()
method to be run. If you attempt to run a class that lacks one, NetBeans responds with an error.
52.14.62.221