FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Java/CoreJava/v1ch03/InputTest/InputTest.java at master · mthli/Java · GitHub
mthli
/
Java
Public
Notifications
You must be signed in to change notification settings
Fork
78
Star
137
Code
Issues
2
Pull requests
1
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
Java
/
CoreJava
/
v1ch03
/
InputTest
/
InputTest.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
25 lines (21 loc) · 578 Bytes
Breadcrumbs
Java
/
CoreJava
/
v1ch03
/
InputTest
/
InputTest.java
Copy path
File metadata and controls
25 lines (21 loc) · 578 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import
java
.
util
.*;
/**
* This program demonstrates console input.
* @version 1.10 2004-02-10
* @author Cay Horstmann
*/
public
class
InputTest
{
public
static
void
main
(
String
[]
args
)
{
Scanner
in
=
new
Scanner
(
System
.
in
);
// get first input
System
.
out
.
print
(
"What is your name? "
);
String
name
=
in
.
nextLine
();
// get second input
System
.
out
.
print
(
"How old are you? "
);
int
age
=
in
.
nextInt
();
// display output on console
System
.
out
.
println
(
"Hello, "
+
name
+
". Next year, you'll be "
+ (
age
+
1
));
}
}
Back
|
FazBrowse Home
|
New Git URL