Home  >  Article  >  Java  >  java keyboard entry

java keyboard entry

怪我咯
怪我咯Original
2017-06-27 11:20:442490browse

Keyboard entry (Java):

1. Guide package

Format

     import java.util.Scanner;

  Position

                                                                                                                                                                                                                                                 . .Create keyboard input object

       Format

     Scanner sc = new Scanner(System.in);

  3. Obtain data through the object

       Format

            int x = sc.nextInt();

import java.util.Scanner;

class ScannerDemo {
     public static void main(String[] args) {
          //创建键盘录入数据对象
          Scanner sc = new Scanner(System.in);
          int x = sc.nextInt();
     }
}

The above is the detailed content of java keyboard entry. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn