Magazine
 
NetBeans IDE

 

  1. The above skeleton is created by the IDE according to the information provided before. Now you can add your lines of code in the appropriate place of the file. For our application, the line “// TODO code application logic here”
    has been replaced by the line “System.out.println(“Hello World”);”

    Finally, HelloWorld.java file will look like the following:
     
/*
* HelloWorld.java
*
* Created on November 28, 2007, 2:31
PM
*
* To change this template, choose Tools |
Template Manager
* and open the template in the editor.
*/
package javajazzup;
/**
* This application displays “Hello World” to
the standard output.
*/
public class HelloWorld {
/** Creates a new instance of

 

 
HelloWorld */
public HelloWorld() {
}
/**
* @param args the command line
arguments
*/
public static void main(String[] args) {
System.out.println(“Hello
World”);
}
}

  1. Save the changes by choosing File-
    >Save or pressing keyboard keys
    Ctrl+S.
  2. Compile the source file by selecting
    “Build -> Build Main Project” from
    the main menu.
  3. The result of compilation appears in the
    Output window as shown below:



    If you get BUILD SUCCESSFUL
    statement then you have compiled the
    file successfully and if you get BUILD
    FAILED then there may be any
    syntactical error. Errors are shown in the
    Output window as hyper-linked text.
    Click the link to reach the place of error
    in the code. Remove the error from the
    code and compile it again. After
    successful compilation of the code the
    bytecode file HelloWorld.class is
    generated which can be seen by
    expanding the File window as shown
    below:

 
Dec 2007 | Java Jazz Up | 10
 
previous
index
next
 
View All Topics
All Pages of this Issue
Pages: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,

30
, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53 , 54, 55, 56, 57,

58
, 59, 60, 61, 62, 63 , 64, 65 , 66 , 67 , 68 , 69 , 70 , 71 , 72 , 73 , 74 , 75 , 76 , 77 , 78 , 79 , 80 , 81 , 82 ,

Download PDF