Your answer is within your question - "How can I use an instance of a class that was created by a different class?"
In order to use the instance, you first have to create it. You have the following line...
Login login;
This doesn't create an instance, it just declares a variable as being capable of holding an object of type Login. When you write this line, it is just a pointer to a null, until you call either of these...
login = new Login(); Login login = new Login();
This will create a new instance of the class, which then allows you to access methods in it, such as login.getPortalHandler();
If you need to retain the PortalHandler for use after you're finished with the Login object, you'll need to get a reference to PortalHandler before the Login object is cleaned up.
For example...
PortalHandler portalHandler; public void doLogin(){ Login login = new Login(); login.performLogin(); portalHandler = login.getPortalHandler(); }
In this example, the Login instance only exists for the length of the doLogin() method, after which it is no longer a valid object. However, you have taken a reference to the PortalHandler object before you're finished, ans have stored it as a global variable, so you'll be able to continue using the PortalHandler whenever you want.
Login login = new Login();