Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.09 KB | None | 0 0
  1. import java.io.BufferedReader;
  2. import java.io.FileReader;
  3. import java.io.IOException;
  4. import java.util.HashMap;
  5. import java.util.Scanner;
  6. import java.io.File;
  7.  
  8.  
  9. public class Main {
  10.  
  11.     public static void main(String[] args) throws IOException {
  12.  
  13.         HashMap<String, String> lexikon;
  14.         lexikon = new HashMap<String, String>();
  15.  
  16.         lexikon.put("Apelsin", "orange");
  17.         lexikon.put("Bok", "Book");
  18.         lexikon.put("Stol", "Chair");
  19.         lexikon.put("Mus", "Mouse");
  20.         lexikon.put("Katt", "Cat");
  21.  
  22.         Scanner sc = new Scanner(System.in);
  23.  
  24.         while (true) {
  25.  
  26.             String input = sc.nextLine();
  27.             if (lexikon.containsKey(input)) {
  28.                 System.out.println(lexikon.get(input));
  29.  
  30.             } else {
  31.                 System.out.println("ordet saknas");
  32.             }
  33.  
  34.             try (BufferedReader br = new BufferedReader(new FileReader(File))) {
  35.                 for (String line; (line = br.readLine()) != null; ) {
  36.                     // process the line
  37.  
  38.  
  39.                 }
  40.  
  41.             }
  42.         }
  43.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement