when you call "new Button()" then the classloader takes care to load the "Button" class from the classpath (or uses the previously loaded "Button" class).
So perhaps you want to instantiate a class which name you only know at runtime ? then have a look at java.lang.Class (e.g. the methods Class.forName() and Class.newInstance()) and perhaps the stuff in java.lang.reflect package.
this invokes the no-argument constructor of the Baz class.
Joined: Jun 19, 2001
forgot: the class must be on the classpath, no matter how you instantiate it.
and if you are really talking about loading a class, then you should dig into the Classloader class.