Creating Your Java First Program
Your first application,HelloWorldApp
, will simply display the greeting "Hello World!"To create this, just follow the steps below :Then choose a Java Application project from Java category.
Click Next, and choose a name for your project (in the Project Name text box).
Make sure that the box "Create Main Class" is checked (this will create a Java application with a predefined main class), then click Finish:
As you can see, NetBeans created the first class and the main () function in which we will write our code.
Type this line of code in the main () function:
System.out.println ("Hello World");
You get then the following code :
package firstapp; public class FirstApp { public static void main(String[] args) { System.out.println ("Hello World"); } }
No comments:
Post a Comment