If I have a class like this:
public class Tester {
ObjectType1 ot1;
ObjectType2 ot2;
ObjectType3 ot3;
public void main(String args) {
//Preliminary checking, resulting in bRun being
//true or false -- true means we continue, false, we quit:
if (bRun) {
Tester t = new Tester();
t.doStuff();
}
System.exit(0);
}
public Tester() {
//do stuff to create an instance of this class
ot1= new ObjectType1;
ot2= new ObjectType2;
ot3= new ObjectType3;
return;
}
public void do Stuff() {
//main processing routines to do stuff in this object
return;
}
}
Does this class load the files for the classes ObjectType1, 2, and 3 when
this class is first called from the command line, or does it wait and load
those classes from disk when the main() method calls Tester() to create an
object? In other words, if bRun is false, and the main() method never
creates an object of type Tester, are the other classes ever loaded?
I'm concerned about speed and trying to create a small class to determine
whether another class, that uses a good number of objects (like
ObjectType1, 2, & 3 are used above) needs to run. I won't have to create
an extra class if I can keep a long list of objects from loading until the
main() method actually creates the object.
Thanks!
Hal