Can you explain the usages of class.forname()?
Answer / Aprajita Devi
The `Class.forName(String className)` method in Java is used to load a class described by its fully-qualified name (class name including package name) at runtime. This method can be useful for dynamic class loading or when using external JAR files.nnFor example:nn```javanClass myClass = Class.forName("mypackage.MyClass");nObject obj = myClass.newInstance();n``` Replace `mypackage.MyClass` with the fully-qualified name of your class.
| Is This Answer Correct ? | 0 Yes | 0 No |
What is floor in java?
What is the use of static methods?
What is the purpose of using break in each case of switch statement?
What will happen to the exception object after exception handling?
What is the static method?
Iterator in the HashMap is fail-safe means what?
What is the life cycle of Thread ?
12 Answers HCL, Varnar Softech,
Can we override tostring method in java?
When do we use hashset over treeset?
What are class members by default?
How u dubugg ur project?
How will you invoke any external process in java?