askIT

Java First code

Start a new project by clicking
New -> Project...

01_netbeans_nytt_prosjekt.jpg

Select Java Application.
02_netbeans_choose_project.jpg

The project title is "MyProject". Press Finish after you have entered the project title.
03_netbeans_name_and_location.jpg

Copy the code below and paste it into your empty project file.

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/

package myproject;

/**
*
* @author bruker
*/

public class MyProject {

        /**
        * @param args the command line arguments
        */

        public static void main(String[] args) {
                // TODO code application logic here
                System.out.println("Hey, this is my first Java program!");
        }
}

You can now run the project by clicking the arrow. netbean_run.png

The output is located at the bottom. It is the result of the code running.

04_netbeans_hello_world.jpg

Add comment

avatar_blank_60.png

Comment:

Name:

Email:

Comments

No comments yet. You can be the first one to comment. Just write your comment in the form and click on the submit button.