As java doesn't have referencing, how does one pass information between two separate classes?
<p>Sorry for the extremely vague/confusing, I really didn't know how to name this issue. If someone has a better one please feel free too edit it. Onto my issue,</p>

<pre><code>public class Foo()
{
    String name;
    public Foo()
    {
        Bar temp = new Bar();
    }
}    

public class Bar()
{
    public Bar()
    {
        setFooName("newName");
    }

    public void setFooName(String name)
    {   
        // Is it possible call a method in Foo?
    }
}    


public class test {
    static public void main(String[] args) 
    {
        Foo foobar = new Foo();
    }
}    
</code></pre>

<p>I'm still new to java so I'm  not sure if this is even possible, but using C++ I'd normally have a local variable of the 'Foo' inside the 'Boo' class and then pass a reference to the object into the constructor of Bar and then assign it to the local variable in Bar.</p>

<p>As java doesn't have referencing I'm stuck on the matter. The reason I want to do this is the example I have is I need to create a GUI object inside of a class and then have information from the GUI object sent back to the class it was created in.</p>

<p>I do hope this all makes sense, if it doesn't, sorry.</p>
