PDA

View Full Version : What is Class.forName()?



priya01
06-05-2016, 10:16 PM
What is Class.forName()?

Garrysmith
06-28-2016, 01:30 AM
A call to Class.forName("X") causes the class named X to be dynamically loaded (at runtime). A call to forName("X") causes the class named X to be initialized (i.e., JVM executes all its static block after class loading). Class.forName("X") returns the Class object associated with the "X" class. The returned Class object is not an instance of the "x" class itself.

rationalweb
07-20-2016, 10:20 PM
A call to Class.forName("X") causes the class named X to be dynamically loaded (at runtime). A call to forName("X") causes the class named X to be initialized.

web designing comapny (www.rationaltechnologies.com)

Thoughtgrid
08-29-2016, 05:20 AM
This will given fully qualified name of class,this method attempts locate,load and link the class, this function succeed reference to the class object for class if it fails class not found exception thrown this is an main process of an Class.for Name() function.

jeffronald19
12-26-2016, 10:12 PM
The java.lang.Class.forName(String name, boolean initialize, ClassLoader loader) method returns the Class object associated with the class or interface with the given string name, using the given class loader. The specified class loader is used to load the class or interface.

giftsdaniel
01-24-2017, 04:29 AM
The java.lang.Class.forName method returns the Class object associated with the class or interface with the given string name, using the given class loader. The specified class loader is used to load the class or interface.

jenisha
04-05-2017, 12:45 AM
It is used to load the class and it also provides a new way for creating the instance of a class without using the "new" operator. We can use newInstance() to get the instance

pxljobs
05-02-2017, 11:04 PM
These will helpful to load the class into the class loader..

ewastecompany2
06-02-2017, 03:26 AM
forName() is used to load the class at runTime. when we could not decide which class to load

osforum4
07-05-2017, 03:11 AM
This method returns the class object representing the desired class.