title: Can I use an object as a variable of a method in java?
body: <p>Total beginner in coding here, so please, be as beginner friendly as possible! For instance, I've just recently learned about classes and objects in school.
  Also, excuse any wrong naming/confusion :)</p>
  
  <p>I've been having a lot of instances, where I'm writing a method, but want to return more than one variable from it. I thought - "What if I made a class that contained all of the variables I'm working with and then returned just it's instance from my method?</p>
  
  <p>Example:</p>
  
  <pre><code>public class Mathematics {
      int number1;
      int number2;
  }
  
  public class MyClass {
      public static void main (String [] args);
  
  
      public static &lt;class?&gt; MyMethod (&lt;class Mathematics?&gt;)
         //in here, the method works with numbers one and two, and then returns them, like so:
        return Mathematics;
      }
  }
  </code></pre>
  
  <p>Now bear in mind, this is not EXACTLY what I want to do, but essentially, I want to use a class as a "container of variables" used in a method in another class.
  If this is not the way to do it, I'd like to know what is (and please, keep it as simple as possible :) ).</p>
  
  <p>Thanks!</p>