Friday, September 16, 2016

How to create simple java program which print "Hello World!" ?
Here I'm showing some simple steps just follow to do so.
Step1:
------
Open notepad 
Step2:
-------
Just type below java code.


public class HelloWorld
{
public static void main(String args[])
{
System.out.println("Hello World!");
}

}

Step3:
--------
save the program with calss name and with .java extension. In the above program class name is HelloWold,

so you should save above program with HelloWorld.java
        My Suggestion:
------------------

Open 'D' Drive --->Create Folder with JavaExamples--->Take a new .txt file--->type javacode--->save as HelloWorld.java

Step4:
after saved the file, you have to compile the program, for that you need to open command prompt. To open command prompt press windowslogo+R you will see the below prompt type cmd and press OK button. After follow the below figure commands to move the cursor to your JavaExamples directory.


Compilation:
----------------
Now you have to compile your java program for to see the below figure continuation to above command prompt figure.
Syntax:
--------
javac FileName.java
Ex:javac HelloWorld.java
After Compilation successful it won't give you any successful message instead
it simply create .class file in your directory this is your conformation to run java program.

Execute Java Program:
-----------------------------
Syntax:
---------
java FileName

Ex:java HelloWorld






No comments:

Post a Comment