Java program to print integer
Java program to print interger entered by any user.
import java.util.Scanner;
public class HelloWorld {
public static void main(String[] args) {
// Creates a reader which takes input
Scanner reader = new Scanner(System.in);
System.out.print("Enter a number: ");
// nextInt() reads the next integer from user
int number = reader.nextInt();
// println() prints on the output screen
System.out.println("You entered: " + number);
}
}
import java.util.Scanner;
public class HelloWorld {
public static void main(String[] args) {
// Creates a reader which takes input
Scanner reader = new Scanner(System.in);
System.out.print("Enter a number: ");
// nextInt() reads the next integer from user
int number = reader.nextInt();
// println() prints on the output screen
System.out.println("You entered: " + number);
}
}
Comments
Post a Comment