fork(1) download
  1. package englishmorsecode;
  2.  
  3. import java.util.HashMap;
  4. import java.util.Map;
  5.  
  6. public class EnglishMorseCode {
  7.  
  8. private String[][] morseArray = new String[][]{
  9. {"A", ".-"}, {"B", "-..."}, {"C", "-.-."}, {"D", "-.."}, {"E", "."}, {"F", "..-."}, {"G", "--."}, {"H", "...."}, {"I", ".."}, {"J", ".---"},
  10. {"K", "-.-"}, {"L", ".-.."}, {"M", "--"}, {"N", "-."}, {"O", "---"}, {"P", ".--."}, {"Q", "--.-"}, {"R", ".-."}, {"S", "..."}, {"T", "-"},
  11. {"U", "..-"}, {"V", "...-"}, {"W", ".--"}, {"X", "-..-"}, {"y", "-.--"}, {"z", "--.."}, {"1", ".----"}, {"2", "..---"}, {"3", "...--"}, {"4", "....-"},
  12. {"5", "....."}, {"6", "-...."}, {"7", "--..."}, {"8", "---.."}, {"9", "----."}, {"0", "-----"}, {" ", "|"}
  13. };
  14.  
  15. private Map<String, String> enToMorse;
  16. private Map<String, String> morseToEn;
  17.  
  18. /**
  19.   * @param args the command line arguments
  20.   */
  21. public static void main(String[] args) {
  22.  
  23. Map<String, String> morse = new getMorseToEn();
  24. String x = morse.get("...");
  25.  
  26. System.out.println(x);
  27.  
  28. }
  29.  
  30. private Map<String, String> getMorseToEnMap() {
  31. if (morseToEn == null) {
  32. morseToEn = new HashMap<String, String>();
  33. for (String[] x : morseArray) {
  34. morseToEn.put(x[1], x[0]);
  35. }
  36. }
  37. return morseToEn;
  38. }
  39. }
  40.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:6: error: class EnglishMorseCode is public, should be declared in a file named EnglishMorseCode.java
public class EnglishMorseCode {
       ^
Main.java:23: error: cannot find symbol
        Map<String, String> morse = new getMorseToEn();
                                        ^
  symbol:   class getMorseToEn
  location: class EnglishMorseCode
2 errors
stdout
Standard output is empty