Blog

Print Hello world in Java

Java / Java Programs

Print Hello world in Java

Let’s start with the first Program to Print Hello world in Java.
A basic program Hello world in Java, that displays “Hello, World!”. It’s mostly used to illustrate the syntax of the language.

Print Hello world in Java

To understand this example, you should have the knowledge of following Java programming topics:
Classes in Java

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

Output

Hello World!

In the above program, we have used here built-in System.out.println() method to print the string Hello, world!on our screen.
Where System is a class , out is object reference and println() is method ,together they responsible to print anything on console ,
i.e anything which is given in double quotes will be printed on the console screen , but unlike printf() function of C Programming Language , something is special about this method.
If you run the above code , you will be surprised by the automatic generated new line because the method println() in Java generates new line after printing something on console which is pretty good for us.
Since in C Programming language we specifically need to put backslash n (‘\n’) in order to generate a new line
Related Program
1.Java Program to Add Two Numbers
2.Java Program to Add Two Numbers Given by User
3.Java Program to find the area of Triangle
4.Java Program to Solve Quadratic Equation
Ask your questions and clarify your/others doubts by commenting. Documentation

Select the fields to be shown. Others will be hidden. Drag and drop to rearrange the order.
  • Image
  • SKU
  • Rating
  • Price
  • Stock
  • Availability
  • Add to cart
  • Description
  • Content
  • Weight
  • Dimensions
  • Additional information
Click outside to hide the comparison bar
Compare