title: How do I add two methods in java?
body: <p>I have written a code like this:</p>
  
  <pre><code>public class method{
  int p;
  static void number1(){
      int x, y, z;
      x=2;
      y=2;
      z=x+y;
  }
  static void number2(){
      int x, y, z;
      x=3;
      y=2;
      z=x+y;
  }
  public static void main (String [] args){
      p=number1()+number2();
  }}
  </code></pre>
  
  <p>So you can see what I want to do but I don't know the way to do this. I just tried that one but it didn't work. Any ideas?</p>
  
  <p>Thanks for the any help!</p>
  
  <hr>
  
  <p>Final code is:</p>
  
  <pre><code>public class method{
  static int p;
  static int number1(){
      int x, y, z;
      x=2;
      y=2;
      z=x+y;
      return z;
  }
  static int number2(){
      int x, y, z;
      x=3;
      y=2;
      z=x+y;
      return z;
  }
  public static void main (String [] args){
      p=number2()+number1();
      System.out.println(p);
  }}
  </code></pre>
  
  <p>Guys,
  Thank you so much it worked very well.</p>