-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReadKeyBoard.java
More file actions
44 lines (32 loc) · 1.11 KB
/
ReadKeyBoard.java
File metadata and controls
44 lines (32 loc) · 1.11 KB
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
35
36
37
38
39
40
41
42
43
44
package com.ReadKeyBoard;
// i am going to show you how to scanner read keywords form keyboard
// write a program to read keywords from keyboard using scanner
//import modules
import java.util.Scanner;
public class ReadKeyBoard {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
//The nextInt() method of Java Scanner class is used to scan the next token of the input as an int.
int x=sc.nextInt(); //Note only 1 time 1 veriable can define i just write only
//float x=sc.nextInt();
//double x=sc.nextInt();
System.out.println("You Enter" + x);
}
}
//////////Output///////////
// int condition.. //
// 41 //
// You Enter: 41 //
///////////////////////////
//////////Output///////////
// float condition.. //
// 41 //
// You Enter: 41.00 //
///////////////////////////
//////////Output////////////
// doublecondition.. //
// 41 //
// You Enter: 41.0 //
///////////////////////////
//Thanks you
//bye