Data entry
First you need to import a scanner
Then declare the scanner
Output input Prompt
Receive data from user data
Output data for user data
Instance:
ImportJava.util.Scanner;//Import Scanner Public classtest{ Public Static voidMain (string[] args) {Scanner in=NewScanner (system.in);//declare scanner, assign scanner to inSystem.out.println ("Please enter your name:");//Output input PromptString name = In.next ();//receive user-entered names /*when the user input is received, In.next () is the Receive string type In.nextint () is the receive integer in.nextdouble () is the receive double type*/System.out.println ("Please enter your age");//Output input Prompt intAge = In.nextint ();//age to accept user inputSystem.out.println ("Please enter your gender");//Output input PromptString sex = In.next ();//Accept user-entered gender//output All information entered by the userSystem.out.println ("name" +name); System.out.println ("Age" +Age ); System.out.println ("Gender" +sex); }}
Java User Data entry