title: Pointer Logic in Java
body: <p>I need to find a way to directly modify the private members of a class in Java through a getter function. I know I can do this in C++ using pointers like this;</p>
  
  <pre><code>class FooBar
  {
      private:
          Foo foo;
  
      public:
          Foo* getFoo()
          {
              return &amp;foo;
          }
  }
  </code></pre>
  
  <p>Then I could directly manipulate the private variable <code>foo</code> through the public function <code>getFoo()</code> because getFoo() returns a pointer (eg. <code>getFoo()-&gt;callFunction();</code>)</p>
  
  <p>So all I want to know is, is there a way to replicate this exact same effect in Java??.... Any way at all?</p>