Java Hello World Program

Last Updated On Friday 22nd Apr 2022

hello world java

  • A “Hello, World!” program is generally a computer program that outputs or displays the message “Hello, World!”.
  • This program is very simple to write in many programming languages, and is often used to illustrate a language’s basic syntax.
  • Let’s explore how Java “Hello, World!” program works.

Java Hello World

	// This is a simple Java Hello World program Example.

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

hello world java code

	// This is a simple Java Hello World program Example.
	
  • This is a comment.
  • Like other programming languages, Java lets you enter a remark into a program’s source file.
  • The contents of a comment are ignored by the compiler.
  • Its used to describes or explains the operation of the program.
	class Example {...}
	
  • In Java, every application begins with a class definition.
  • In the program, Example is the name of the class.
  • The class definition begins with the opening curly brace ({) and ends with the closing curly brace (}).

java hello world program

	public static void main(String[] args) {
...........
}
	

hello world in java

  • This line begins the main() method.In general, Java applications begin execution by calling main().
  • The public keyword is an access modifier.
    • An access modifier determines how other parts of the program can access the members of the class.
  • As stated, main() is the method called when a Java application begins.
  • In main() there is only one parameter, String[] args, which declares a parameter named args. This is an array of objects of type String.