| Hello World in java |
|
| programming |
This article describes how to write, compile and execute a "Hello World" program in java on Linux (Fedora).
1. the prerequisites
2. write the code
now write the following code into the sourcefile: save the file and exit vi with ":wq + enter"
important: the source file must have the same name as the public class (HelloWorld.java)
explanationour "main" class is called HelloWorld. public indicates that the class can be used by any program or user.
The main method ist where the execution of the class starts. void indicates that the method does not return any value.
This prints out the string "Hello World!"
3. compile into bytecodeThis produces an file called "HelloWorld.class". 4. run the programyou can now execute the bytecode with:
Comments (0)
Powered by !JoomlaComment 4.0 beta1
!joomlacomment 4.0 Copyright (C) 2009 Compojoom.com . All rights reserved." |


