Hi everbody,
Seen posts saying simple dictionary in Java. Thought of sharing something may be useful for others. Here is a simple code if anyone interested.
import java.util.*;
public class Dictionary {
public static void main(String[] args) {
Map <String, String> dictionary;
dictionary = new TreeMap <String , String>();
Scanner s = new Scanner (System.in);
dictionary.put("discuss", "talk about something");
dictionary.put("fissure", "a narrow opening");
dictionary.put("spasmodic", "sudden but for short time");
System.out.println("Enter a word :");
String search = s.next();
if(dictionary.containsKey(search)){
System.out.println(dictionary.get(search));
}
}
}