Skip to content

Commit 233cb40

Browse files
Mini Dictionary.java
1 parent b7d6ad4 commit 233cb40

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

Mini Dictionary.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import java.util.*;
2+
3+
public class Dictionary {
4+
public static void main(String[] args) {
5+
HashMap<String, String> map = new HashMap<>();
6+
map.put("java", "A powerful programming language");
7+
map.put("python", "Dynamic scripting language");
8+
9+
Scanner sc = new Scanner(System.in);
10+
System.out.print("Word: ");
11+
String w = sc.nextLine();
12+
13+
System.out.println(map.getOrDefault(w, "Not found!"));
14+
}
15+
}

0 commit comments

Comments
 (0)