Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

flow control

Status
Not open for further replies.

bardley

Programmer
May 8, 2001
121
US
Hey.

I am a true java beginner. I am trying to write an app that requires a login before you enter the main portion of the app. As of right now, I have a "main" in the main class that creates a form object, which handles connection to the database and verification of the user's id.

However, the "main" keeps executing without waiting for the login to return.

Code samples:

-----------8<----------------

public static void main(String arg[]) {

System.out.println(&quot;Application Starting&quot;);
new APP();

// Connect to the database by providing a username and password
login newLogin = new login();
System.out.println(&quot;Returned to main&quot;);
}

------------>8---------------

The problem is that this doesn't wait for newLogin to finish before it prints &quot;Returned to main&quot;. How can I achieve this behavior?

Thanks all! Brad Gunsalus
Cymtec Systems, Inc.
bgunsalus@cymtec.com
 
Show the code for login. You are just creating an instance of the class, you never call any methods so unless all of your login stuff is executed from the constructor than it is not even being called.

One last note, it is pretty much standard procedure to capitialize class names so I highly recommend you change the login to Login.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top