FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Java/inputs.java at main · Eggy115/Java · GitHub
Eggy115
/
Java
Public
Uh oh!
There was an error while loading.
Please reload this page
.
Notifications
You must be signed in to change notification settings
Fork
5
Star
3
Code
Issues
0
Pull requests
0
Discussions
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Java
/
inputs.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
34 lines (28 loc) · 1.08 KB
Breadcrumbs
Java
/
inputs.java
Copy path
File metadata and controls
34 lines (28 loc) · 1.08 KB
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
26
27
28
29
30
31
32
33
34
import
java
.
util
.
Scanner
;
// Import the Scanner class
public
class
inputs
{
public
static
void
main
(
String
args
[]) {
// Variable declaration
String
name
;
int
age
;
// Create a Scanner object
Scanner
myScanner
=
new
Scanner
(
System
.
in
);
System
.
out
.
print
(
"Enter your name : "
);
name
=
myScanner
.
nextLine
();
// Read user input - String(with all white spaces)
System
.
out
.
print
(
"Enter your age : "
);
age
=
myScanner
.
nextInt
();
// Read user input - Int
// Output user input
System
.
out
.
println
(
name
);
System
.
out
.
println
(
age
);
}
}
/*
Method Description
nextBoolean() Reads a boolean value from the user
nextByte() Reads a byte value from the user
nextDouble() Reads a double value from the user
nextFloat() Reads a float value from the user
nextInt() Reads a int value from the user
nextLine() Reads a String value from the user
nextLong() Reads a long value from the user
nextShort() Reads a short value from the user
*/
Back
|
FazBrowse Home
|
New Git URL