Java Program To Print Hello World

15 Likes 7 Comments
Java Program to Print Hello World

Hello Shouters!! Today we will learn the most basic program that is Java Program To Print Hello World.

As a beginner, it is very tough to write big programs or do extensive data manipulation. So, the “Hello World” program is the simplest one and in this, we will understand how we can print a string or a message on the output screen.

If you do not have any platform for running the java code or you do not have basic knowledge of programming, please read the Introduction and Installation of Java on Windows.

1. First Method- To Print Hello World:

First we will create a class and we can name the class what we want to. We have made a class name “Hello World”. Then we will declare the main function and will use System.out.println() to print the string on the output screen.

Output – Hello World

2. Second Method – Using Functions

In this, we created a function named Hello_World and will call it from the main function like Hello_World(); and the function will be executed and we will get the Hello World Output.

Output – Hello World

Try to run Java Program to print Hello World on your Personal Computer with both the method given above

We daily add Multiple Choice Questions for placement preparation questions and technical interview preparation on the Instagram page. Check the Instagram account:

Frequently Asked Questions –

❓Why we make a class for running Hello world Program

Java is a pure Object Oriented Programming language and for running program. You have to make a class.

❓What is public static void main function

public static void main is a function which is executed when we run the program. Without this function, we cannot run the program.

❓ Why it is important to first print Hello World program

Hello world program is one of the basic program and is mostly programmed when we write first code in a programming language.

❓ What is System.out. println()

This function is used to print the message on the output screen

❓ Why we use*; in the java program

It is used to import the major files that are used to take input/output from the user

Recommended Posts

  1. Introduction and Installation of Java on Windows
  2. Program to add two numbers in Java
  3. Java Program to Calculate the Factorial of a number.
  4. Java Program to Swap two numbers
  5. Java Program to Check Whether a Number is an Even or Odd
  6. Java Program to find HCF of two numbers

You might like

Simrat Kaur

About the Author: Simrat Kaur


Leave a Reply

Your email address will not be published. Required fields are marked *

Close Bitnami banner