Running the Application

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.

Figure A.4. Output of the Spartacus application.

Image

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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
52.14.62.221