This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
Does anyone know the difference between creating an object using the new keyword and Beans.instantiate() as shown below? modelManager = (ModelManager) Beans.instantiate(this.getClass().getClassLoader(), "com.sun.j2ee.blueprints.petstore.control.web.ModelManager"); (Code taken from the PetStore MainServlet.java). Thanks, Francois
To me the biggest difference is when you use instantiate(), you don't have to know the Class name of the object at development time. The class that you want an instance of can be determined at runtime from a String. Matt