fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. public class DFA
  8. {
  9. private Map<Transition, State> transitions;
  10. private State startState;
  11. private Set<State> finalStates;
  12.  
  13. public DFA(State start)
  14. {
  15. transitions = new HashMap<Transition, State>();
  16. finalStates = new HashSet<State>();
  17. startState = start;
  18. }
  19.  
  20. public void addTransition(State from, char on, State to)
  21. {
  22. Transition t = new Transition(from, on);
  23. transitions.put(t, to);
  24. }
  25. }
  26.  
  27. public class Transition
  28. {
  29. private State startState;
  30. private char delta;
  31.  
  32. Transition(State start, char d)
  33. {
  34. startState = start;
  35. delta = d;
  36. }
  37. }
  38.  
  39. public class State
  40. {
  41. private final String name;
  42.  
  43. public State(final String n)
  44. {
  45. name = n;
  46. }
  47.  
  48. public String getName()
  49. {
  50. return name;
  51. }
  52. }
  53.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:7: error: class DFA is public, should be declared in a file named DFA.java
public class DFA
       ^
Main.java:27: error: class Transition is public, should be declared in a file named Transition.java
public class Transition
       ^
Main.java:39: error: class State is public, should be declared in a file named State.java
public class State
       ^
3 errors
stdout
Standard output is empty