How can I use an instance of a class that was created by a different class?
<p><strong>Login.java</strong></p>

<pre><code>PortalHandler portalHandler = new PortalHandler(dataString);
...
public PortalHandler getPortalHandler(){
        return portalHandler;
    }
</code></pre>

<p><strong>PortalHandler.java</strong></p>

<pre><code>public String getName()
{
return name;
}
</code></pre>

<p><strong>ThirdClass.java</strong> I want to get to get the name in that instance created by login.java but following gives an null pointer error</p>

<pre><code>Login login;
PortalHandler portalHandler = login.getPortalHandler();
</code></pre>

<p>How can it be done?</p>
