Java Program to Print an Integer

In this tutorial you will learn about the Java Program to Print an Integer and its application with practical example.

Java Program to Print an Integer

In this tutorial, we will learn to create a Java program that will print an Integer in Java programming.

Prerequisites

Before starting with this tutorial, we assume that you are the best aware of the following Java programming topics:

  • Operators in Java Programming.
  • Basic Input and Output function in Java Programming.
  • Basic Java programming.

What is a data type?

A data type, in every programming language, specifies which type of value a variable is going to hold in the program. i.e. integer, character, float, double.

Algorithm:-

Program Print an Integer.

In this tutorial, First, we will take an integer number input from the user. Secondly, we will print that number to the user using the print function. Let’s take an example below.

With the help of this program, we can print an Integer.

Program to print an integer:-

Output:-

In the above program, we have first initialized the required variable.

  • no = it will hold the input integer value from the user.

Importing the scanner in util package for the program.

Taking the input from the user in integer format.

Printing the integer value to the user by print function.

In this tutorial we have learn about the Java Program to Print an Integer and its application with practical example. I hope you will like this tutorial.