-
Notifications
You must be signed in to change notification settings - Fork 7
/
ScannerExample.java
27 lines (25 loc) · 973 Bytes
/
ScannerExample.java
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
import java.util.Scanner;
public class ScannerExample {
public static void main(String... args) {
int id;
String name;
double salary;
String companyName;
// creating scanner object
Scanner sc = new Scanner(System.in);
System.out.println("Please Enter Employee-Id");
id = sc.nextInt();
System.out.println("Please Enter Employee name");
name = sc.next();
System.out.println("Please Enter Company Name");
companyName = sc.next();
System.out.println("Please Enter Employee Salary");
salary = sc.nextDouble();
System.out.println("============= Employee Details ==============");
System.out.println("Employee-Id : " + id);
System.out.println("Employee-name : " + name);
System.out.println("Employee Company : " + companyName);
System.out.println("Employee-salary : " + salary);
sc.close();// close scanner
}
}