Saturday, May 14, 2016

Java Hello World - Program in java

Java is considered as one of the most powerful and popular programming language of all time because of below features.
  • Security
  • Portability
  • Robust 
  • Object Oriented
  • Architecture-neutral and etc
 So Java is the one programming language which programmer can choice for the future career and whenever we talk about coding of any programming language we first code very first code "Hello World " Program

 Here we go .

Code-

public class HelloWorld {

    public static void main(String[] args) {

        System.out.println("Hello World");

    }

Where to write the code-
  1. Open notepad (open run and type notepad hit enter)
  2. write the above code and save the file as HelloWorld.java(same as the class name ).
How to Run the Program
  1. open command prompt
  2. navigate to the file where you save the HelloWorld.java file in console.
  3. write below command
    javac HelloWorld.java
  4. The above command will compile the program and create a file HelloWorld.class
  5. now run
    java HelloWorld
    Your Program will run and you will see in console "Hello World"

    This is very basic and beginner's first program in java world.
    Hope you guys will able to understand the program and if you are facing any problem do comment.
     




0 comments:

Post a Comment