title: Access Variables from public static void main(String[] args)
body: <p>i started learning Java some days ago.
  I have some experience with C++ and this is why I'm used to pointers, which would make this much easier.</p>
  
  <p>so now my question. </p>
  
  <p>Let's say I have the following Code:</p>
  
  <pre><code>public class Main {
  
      public static void main(String[] args) {
  
          int variable1=2, variable2=2;
  
          input(variable1, variable2);
  
          System.out.println(variable1 + " " + variable2); 
              // this should output "1 3" on the console  
      }
  
      private static void input(int variable1, int variable2) {
  
          System.out.println(variable1 + " " + variable2); 
              // this will output "2 2" on the console
  
          variable1 = 1;
          variable2 = 3;
      }   
  }
  </code></pre>
  
  <p>So the function <code>input()</code> takes the Variables from main and outputs them (correctly).
  But how can I transfer the changed Variables back to the main function?</p>