Create a class, create a Scanner in the main method of the class to scan and encapsulate the in input stream of the System class, and then prompt the user to enter the ID number and enter the number of digits of the ID number.
The code is as follows:
The code copy is as follows:
import java.util.Scanner;
public class InputCode {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);// Create an input stream scanner
System.out.println("Please enter your ID number:");// Prompt the user to enter
String line = scanner.nextLine();// Get a line of text entered by the user
// Print a description of the input text
System.out.println("So your ID number is" + line.length() + "digits");
}
}