Skip to content
Sharp

Java Annotations · interview question

Which method is used to load a class dynamically at runtime in Java?

Multiple choiceEasychapter-16-curatedpremiumjava-annotationsannotation-processors
Choose one answer
Answer and explanation

Correct answer

C. Class.forName()

Why

Class.forName() is used to dynamically load a class at runtime by its fully qualified name, which is often used for JDBC drivers and other dynamic loading requirements.

Test yourself on Java Annotations

A free test with instant, explained results. No account needed.

Start free test
All Java Annotations questions →