-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHashMapdemo.java
More file actions
33 lines (32 loc) · 1.24 KB
/
HashMapdemo.java
File metadata and controls
33 lines (32 loc) · 1.24 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
import java.util.Scanner;
import java.util.HashMap;
import java.lang.String;
public class HashMapdemo {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
HashMap<String, HashMap<String, Object>> var = new HashMap<>();
String name_input = new String();
String password_input = new String();
String email_input = new String();
int age_input;
for (int i=0; i<3; i++) {
System.out.println("==========================");
System.out.println("Enter your name: ");
name_input = sc.nextLine();
System.out.println("Enter your password: ");
password_input = sc.nextLine();
System.out.println("Enter your email: ");
email_input = sc.nextLine();
System.out.println("Enter your age: ");
age_input = Integer.parseInt(sc.nextLine());
HashMap<String, Object> temp = new HashMap<>();
temp.put("name", name_input);
temp.put("password", password_input);
temp.put("email", email_input);
temp.put("age", age_input);
var.put(name_input, temp);
}
System.out.println(var);
sc.close();
}
}