-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUserInput.java
More file actions
62 lines (48 loc) · 2.25 KB
/
Copy pathUserInput.java
File metadata and controls
62 lines (48 loc) · 2.25 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import java.util.Scanner;
public class UserInput
{
public static void main(String[] args)
{
Scanner scan = new Scanner(System.in);
System.out.println("Enter Your name");
String name = scan.nextLine();
System.out.println("Enter your age only in Integers eg- 1,2,3,4,10");
int age = scan.nextInt();
System.out.println("Enter your gender");
String gen = scan.next();
System.out.println("Enter birth date eg- 01, 10, 20 only in this format only numbers");
int date = scan.nextInt();
System.out.println("Enter birth Month eg- 01, 02, 10, 12 only in this format only numbers");
int month = scan.nextInt();
System.out.println("Enter birth year eg- 1995, 2000, 2003 only in this format only numbers");
int year = scan.nextInt();
System.out.println("Enter your Caste Gen, OBC, ST, SC, other");
String caste = scan.next();
System.out.println("Your name is " + name);
System.out.println("Your age is " + age);
System.out.println("Your Gender is " + gen);
System.out.println("Your Date of birth is " + date + "/" + month + "/" + year);
System.out.println("Your caste is " + caste);
}
}
/* Output -
Enter Your name
Athrva Deshmukh
Enter your age
20
Enter your gender
Male
Enter birth date eg- 01, 10, 20 only in this format
21
Enter birth Month eg- 01, 02, 10, 12 only in this format
05
Enter birth year eg- 1995, 2000, 2003 only in this format
2003
Enter your Caste Gen, OBC, ST, SC, other
Gen
Your name is Athrva Deshmukh
Your age is 20
Your Gender is Male
Your Date of birth is 21/5/2003
Your caste is Gen
*/