title: How do I pass method as a parameter in Java?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/2186931/java-pass-method-as-parameter">Java Pass Method as Parameter</a>  </p>
  </blockquote>
  
  
  
  <p>Is it possible to pass a method as a parameter in Java? If I can't what would be the best course of action for the method below without having to repeat code.    </p>
  
  <pre><code>public void enterUserInput(javax.swing.JTextField inputField, javax.swing.JTextField   outputField, method rangeChecking){
  
      String input;
      double output;
      input = inputField.getText();
      output = Double.parseDouble(input);
      if(rangeChecking(output)){
          outputField.setText(input);
          inputField.setText(null);
      }
  </code></pre>
  
  <p>I will be calling a rangeChecking method from a different class and each time I call the enterUserInput the rangeChecking method will be different</p>