The user input statement in java is written as:
1. [Scanner sc = new Scanner(System.in); 】;
2 , [String input = sc.next();].
(Recommended video tutorial: java video)
The specific code is as follows:
import java.util.Scanner; public class Number { /** * @param args * author:sun * time:2011-05-25 12:10 */ public static void main(String[] args) { // TODO Auto-generated method stub System.out.println("请输入内容:"); Scanner sc = new Scanner(System.in); String input = sc.next(); System.out.println("你输入的内容为:"+input); } }
Recommended tutorial: java entry program
The above is the detailed content of How to write input statement in java. For more information, please follow other related articles on the PHP Chinese website!