how to know is object created

G

GArlington

Hello,

Is it possible to know is class object created?

Thank you

If (objRef != null)
or do you mean if it is created successfully, whatever you would mean
by this?
 
A

Andreas Leitgeb

Hello,
Is it possible to know is class object created?

By hooking into the classloader (that is: install your own derived
classloader), you would be able to keep track of which classes are
being loaded (except for those loaded by system's classloader).

If it's about your own classes, you could have a static initializer
block "static { ... }" register the class somewhere central, e.g.
by adding it's name to a Collection in a central class, so you'll
find it, once it's loaded.

If these all fail, reflection might also offer ways...

Why do you even want to know? If you try to use the class, and
it isn't yet loaded, then it will be.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top