Home >Java >Javagetting Started >How to input from keyboard in java

How to input from keyboard in java

(*-*)浩
(*-*)浩Original
2019-11-13 10:54:4412618browse

How to input from keyboard in java

First of all, if java wants to receive keyboard input, it needs to use the Scanner class. To use the Scanner class, you need to import it in advance. (Recommended learning: java course)

How to input from keyboard in java

##After importing the required classes, create a new Scanner Class object to use to receive input.

How to input from keyboard in java

After the object is created, we can call the corresponding method of the object to extract data from it.

How to input from keyboard in java

Note that we can extract input data from the same object multiple times in a row.

How to input from keyboard in java

The above is the detailed content of How to input from keyboard in java. 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