Home > Java > JavaBase > How to write input statement in java

How to write input statement in java

王林
Release: 2020-04-30 16:42:09
Original
19474 people have browsed it

How to write input statement in java

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);
}
}
Copy after login

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!

Related labels:
Statement of this Website
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
Latest Issues
Install JAVA
From 1970-01-01 08:00:00
0
0
0
Unable to install java
From 1970-01-01 08:00:00
0
0
0
Can java be used as the backend of the web?
From 1970-01-01 08:00:00
0
0
0
Is this in Java language?
From 1970-01-01 08:00:00
0
0
0
Help: JAVA encrypted data PHP decryption
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template