-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJava
More file actions
19 lines (14 loc) · 698 Bytes
/
Java
File metadata and controls
19 lines (14 loc) · 698 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
accept user enter values
Scanner :
Scanner scanner = new Scanner(System.in); ---- inatilasing scanner
scanner.close(); -- closing the scanner
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
***** when allowing to enter two values always remember to user scanner.nextLine(); else there will be a problem if the next one is
scanner.nextLine(); *******************