Write a  Java Program to Print an Integer (Entered by the User)

Java Program to Print an Integer (Entered by the User)

Welcome to the World of Online Learning:

Hello Friends “This blog helps you to learn Java programming concepts. You can learn Java  language at your own speed and time. One can learn concepts of Java language by practicing various programs given on various pages of this blog. Enjoy the power of Self-learning using the Internet.”

Java Program to Print an Integer (Entered by the User)
Java Program to Print an Integer (Entered by the User)

             Unleashing Java Magic: Where Every Line of Code Comes Alive

Write a  Java Program to Print an Integer (Entered by the User)

PROGRAM:Java Program to Print an Integer (Entered by the User)

/*JJava Program to Print an Integer (Entered by the User) */

import java.util.Scanner;

public class HelloWorld {

public static void main(String[] args) {

// Creates a reader instance which takes
// input from standard input – keyboard
Scanner reader = new Scanner(System.in);
System.out.print(“Enter a number: “);

// nextInt() reads the next integer from the keyboard
int number = reader.nextInt();

// println() prints the following line to the output screen
System.out.println(“You entered: ” + number);
}
}

Leave a Reply

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