Prerequisites :
jdk ( Java Development Toolkit ) must be installed on your PC.
Step 1 :
Open notepad or any editor.
Step 2 :
Write following lines of code in that.
public class HelloWorld {
public static void main(String [] args) {
System.out.println("Hello World!");
}
}
Step 3 :
Store this file in your jdk's bin folder.
Step 4 :
Run following command.
c:\jdk\bin>javac HelloWorld.java
c:\jdk\bin>
"javac" is a java compiler that compiles the source code and creates a <SourceFileName.class> file.
In our case, it will be HelloWorld.class.
The .class file contains the bytecode.
Step 5 :
Run following command.
c:\jdk\bin>java HelloWorld
Hello World!
"java" command (a .exe file in bin folder) runs the bytecode i.e. HelloWorld.class file.
Java command invokes the JVM ( Java Virtual Machine ).
That's all for Hello World! proggy. :)
Have fun in Binary Universe! :)
Read more random topics :
0 comments :
Post a Comment