Java Hello World Program .
How to run your Java Hello World.
Java programs runs on two step . First is compiles in byte code and
creates class file of the source code and then class file load by JVM .
JVM converts byte code in machine code .
These are software you need to run the a simple java code "hello world " java
program .
1. J2SE you can download it from oracle website .
2. Notepad or Notepad++ to write code and edit it or
Eclipse - This is best tool or editor for java programming.
3. MSDos or Unix terminal or Mac terminal
How to write code and compile .
-----------------------------------------------
1. Open notepad write a " Hello World " program and save it with the
same name of the class .
Just for example . My class name is JavaStartProgram then save it
JavaStartProgram.java
2. Open your MsDos set path and set Classpath
3. Type javac and java command separately . If both run successfully
then path and classpath is done properly .
4 . After that you type in c prompt
:c:\ path directory> javac JavaStartProgram.java
---> path directory =path where you java code is.
if your code is correct then it will compile successfully .
5. If it compile successfully then type
C:/Path > java JavaStartProgram
you can see Hello World as output .
How to write HelloWorld Program
-----------------------------------------
This how we write a hello world code.
class JavaStartProgram {
// main method
public static void main ( String args[]){
System.out.println( " Hello World") ;
}
}
If you are using eclipse then you need to create project . Then create java class and
then type this code and run .
Java Hello World Program .
Reviewed by Mukesh Jha
on
5:39 AM
Rating:
No comments:
Add your comment