title: How to return String form actionPerformed?
body: <p>I'm trying to use buttons to control actions performed on a window. To do this I'm trying to return strings to give commands across the program. So far I managed to get this code to work:</p>
  
  <pre><code>@Override
  public void actionPerformed(ActionEvent e) {
      setCommand(e.getActionCommand());
  }
  
  public void setCommand(String g){
      command = g;
      getCommand();
  }
  
  public String getCommand() {
      return command;
  }
  </code></pre>
  
  <p>However when I do this in a different class nothing happens:</p>
  
  <pre><code>System.out.print(button.getCommand());
  </code></pre>
  
  <p>Am I doing something wrong or am I simply using the wrong solution?</p>