[JAVA] Destroy object itself

Hello

i must simulate a web application by java program.

In main i call login form. This must create a Session object associated with user. The costructor of Session object must checks in database if username exist. If username exist it initializes other Session object variables, otherwise it must destroy itself, because the session can't be created.

In login form, before use Session object, i use "instanceof" to check if Session object exist, but how i can destroy Session object itself?

If you have another similar idea, post it please.

Bye.

[585 byte] By [PremierITAa] at [2007-11-27 2:41:21]
# 1
> This must create a Session objectDon't create Session object before login authentication/authorization.
hiwaa at 2007-7-12 3:05:02 > top of Java-index,Java Essentials,Java Programming...
# 2
It will be ottimal solution but login is made by Session constructor
PremierITAa at 2007-7-12 3:05:02 > top of Java-index,Java Essentials,Java Programming...
# 3
> It will be ottimal solution but login is made by> Session constructorA wrong design.
hiwaa at 2007-7-12 3:05:02 > top of Java-index,Java Essentials,Java Programming...
# 4
I'm agree.What is your solution?
PremierITAa at 2007-7-12 3:05:03 > top of Java-index,Java Essentials,Java Programming...