0
What does this code represent?
import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner scan = new Scanner (System.in); System.out.println("inter number"); int user_input_number = scan.nextInt(); System.out.println("entered number is"); System.out.print(user_input_number ); } }
2 Réponses
+ 5
It scans a number and prints it.
+ 2
The code ask user to enter a number then print the same.
1. importing scanner class to have accessibility for input object.
2. class code begins.
3.main function begins.
4. declared object of scanner class to take input.
5. message user to enter a number.
6. takes input in an int type var user_input_number. using nextInt function.
7.print the same user input on screen.