title: java pass reference to a function
body: <p>I am a little confused with Java "All passings by value" concept. </p>
  
  <p>Consider the following code:</p>
  
  <pre><code>class Test {
      Integer A;
      String B;
      ...
  
      void SetVar(Object??? var, Object value) {
          // Set A variable to the value (considering that it's possible)
      }
  }
  </code></pre>
  
  <p>can I code the <code>SetVar</code> function in the way that the following code sets <code>A</code> to <code>2</code> and <code>B</code> to <code>Hi</code>??</p>
  
  <pre><code>void Init() {
      SetVar(this.A, 2);
      SetVar(this.B, "Hi");
  }
  </code></pre>