Environment or JAVA and Hello-World Java Program



We need to configure Java after downloading to run java programs





  • Download the Java from the internet.

  • The setup includes JDK and JRE.

  • After downloading, open My computer.

  • Right click on icon This PC

  • select properties.

  • Click on Advanced System Settings

Then follow the steps as shown below.





Set the above JDK and JRE paths.

Press WIN+R , type CMD press Enter.

type javac on cmd.

If java is correctly installed and classpath variable is correctly set , you should be able to get the output which contains options and explaination.

IDE for JAVA- Eclipse is the best IDE for Java Applications. You can download it from official eclipse website.



Below is the simple Hello-world program in Java.



public class Hello_World
{

  public static void main(String[] args)

{

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

}


}

Explaination.


  • public class Hello_world

          public is an access specifier which means this class is accessible to all other programs even out of the package. Class contains all methods and objects. Hello_world is the name of class.
  • public static void main(String [] args)
           Every Java program must contain main() method. main() method is the entry point for every Java Application. An array of String is passed to the main method. This array can be accessed from command line.

  • System.out.println()
           This statement is used to print sentence on console. Any sentence written in the double quotes of this statement is printed on the screen. After writing on the screen , it automatically comes to new line to write any other sentence.



Environment or JAVA and Hello-World Java Program Environment or JAVA and Hello-World Java Program Reviewed by vishal on August 04, 2017 Rating: 5

No comments