-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscanner.java
More file actions
32 lines (28 loc) · 936 Bytes
/
scanner.java
File metadata and controls
32 lines (28 loc) · 936 Bytes
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
import java.util.Scanner;
class Differ
{
public static void main(String args[])
{
System.out.print("Enter name id salary: ");
Scanner sc = new Scanner(System.in);
String name = sc.next();
int id = sc.nextInt();
double sal = sc.nextDouble();
System.out.println("Your name is " + name);
System.out.println("Your id is " + id);
System.out.println("Your salary is " + sal);
}
}
// import java.util.Scanner;
// class Differ
// {
// public static void main(String args[])
// {
// Scanner scn = new Scanner(System.in);
// System.out.print("Enter an integer: ");
// int a = Integer.parseInt(scn.nextLine()); // if use int a = scn.nextInt, no chance of inputting string is there
// System.out.print("Enter a String: ");
// String b = scn.nextLine();
// System.out.printf("You have entered:- " + a + " " + "and name as " + b + "\n");
// }
// }