Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.BufferedReader;
- import java.io.FileReader;
- import java.io.IOException;
- import java.util.HashMap;
- import java.util.Scanner;
- import java.io.File;
- public class Main {
- public static void main(String[] args) throws IOException {
- HashMap<String, String> lexikon;
- lexikon = new HashMap<String, String>();
- lexikon.put("Apelsin", "orange");
- lexikon.put("Bok", "Book");
- lexikon.put("Stol", "Chair");
- lexikon.put("Mus", "Mouse");
- lexikon.put("Katt", "Cat");
- Scanner sc = new Scanner(System.in);
- while (true) {
- String input = sc.nextLine();
- if (lexikon.containsKey(input)) {
- System.out.println(lexikon.get(input));
- } else {
- System.out.println("ordet saknas");
- }
- try (BufferedReader br = new BufferedReader(new FileReader(File))) {
- for (String line; (line = br.readLine()) != null; ) {
- // process the line
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement