title: i'm trying to learn methods for the first time but i am just getting an error when trying to compile
body: <p>I'm trying to figure out the proper way to set up method code but keep getting an error. I've made sure I have the right braces where they are supposed to be. And all the code is inside the class so I'm really confused. It's probably a simple fix but I can't see it.</p>
  
  <pre class="lang-java prettyprint-override"><code>import java.util.Scanner;
  
  public class NumbersFunctions {
      public static void main(String[] args) {
          Scanner keyboard = new Scanner(System.in);
  
          double x, y, z;
          System.out.println("Please input 3 numbers");
          x = keyboard.nextDouble();
          y = keyboard.nextDouble();
          z = keyboard.nextDouble();
  
          public double smallest(double x, double y, double z)
          {
              if (x &lt; y &amp;&amp; x &lt; z) {
                  System.out.println(x);
              } else if (y &lt; z) {
                  System.out.println(y);
              }
          }
      }
  }
  </code></pre>
  
  <p>This is the error I get:</p>
  
  <pre><code>  Numbers.java:10: error: illegal start of expression
    public double smallest(double x, double y, double z) {
    ^
    Numbers.java:19: error: class, interface, or enum expected
    }
  </code></pre>