📜  在java代码示例中输入数字

📅  最后修改于: 2022-03-11 14:52:24.659000             🧑  作者: Mango

代码示例1
import java.util.*;
class InputNum {
  
  public static void main(String args[]) {
  Scanner sc = new Scanner(System.in);
    
    System.out.print("Enter a number: "); // will ask the user to input number
    int enter = sc.nextInt(); // stores the number input
    
    // print the value by calling enter variable
    System.out.println(enter); 
  }
}