Tuesday, December 28, 2010

How Much Does A Golds Gym Owner Make

My first Java program

Let's write our first program in Java using the Netbeans IDE, which is to display a message on the Netbeans output (output), so we must have previously installed the JDK (if you have not installed even visit this post: Installing JDK) and NetBeans (if you have not installed even visit this post: Installation of Netbeans ). Knowing

Netbeans environment

Before writing the code of our first program we started knowing a little netbeans environment and creating a project. Follow the following
steps:

1) Double click on the icon of Netbeans (a cube of light blue), a screen like this



2) Now create a project (from now on, whenever we will develop an application in Java, we must create a new project)
File -> New Project -> Java -> Java Application , and we click on Next



3) Now we to name our project and select the path where you created
Project Name: name of your project (create a folder with this name in the route selections)
Project Location: displays a default path where you created your project, if you want to leave like this, or select a new route. Select

Set as Main Project and Create Main Class to create a main class in your project (write the name of your main class) and we click Finish .





As you can see, your project has been created which contains a package (container of classrooms, a yellow cube) with the same name of your project within This package is the main class that was created by defecto.Puedes add more packages to the project, and you can add more classes to each package you've created (right click on the packet, New-> Java Class).



My first program

Our first program will be a very simple example, display a message "I like Java."

To do this we must write the following line of code:

 System.out.println ("I love Java"); 


Then your Main class should look like this:

 
package myproject;
/ * *** @ author Carlos * / public class Main {

/ *** @ param args the command line arguments * /
public static void main (String [] args) {
/ / TODO code application logic here
System.out.println ("I love Java");
}}


Now run your program, go to the bar Tools: Run -> Run Main Project and see your message on the screen.

0 comments:

Post a Comment