google search

Custom Search

Thursday, August 7, 2008

Add Code to the Generated Source File

When you created this project, you left the Create Main Class checkbox selected in the New Project wizard. The IDE has therefore created a skeleton class for you. You can add the "Hello World!" message to the skeleton code by replacing the line:
// TODO code application logic here
with the line:
System.out.println("Hello World!"); // Display the string.
Optionally, you can replace these four lines of generated code:
/**
*
* @author
*/
with these lines:
/**
* The HelloWorldApp class implements an application that
* simply prints "Hello World!" to standard output.
*/
These four lines are a code comment and do not affect how the program runs. Later sections of this tutorial explain the use and format of code comments.
Be Careful When You Type

Type all code, commands, and file names exactly as shown. Both the compiler (javac) and launcher (java) are case-sensitive, so you must capitalize consistently.
HelloWorldApp helloworldapp
Save your changes by choosing File Save.
The file should look something like the following:
/*
* HelloWorldApp.java
*
* Created on February 5, 2006, 6:43 PM
*
* To change this template, choose Tools Template Manager
* and open the template in the editor.
*/
package helloworldapp;
/**
* The HelloWorldApp class implements an application that
* simply prints "Hello World!" to standard output.
*/
public class HelloWorldApp {

/** Creates a new instance of HelloWorldApp */
public HelloWorldApp() {
}

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
System.out.println("Hello World!"); // Display the string.
}

}

0 comments:

 

blogger templates | Make Money Online