Search code examples
javaclassloader

In Java, can Class.forName ever return null?


In Java, can Class.forName ever return null, or will it always throw a ClassNotFoundException or NoClassDefFoundError if the class can't be located?


Solution

  • Java Docs says it will throw ClassNotFoundException if the class cannot be found so I'd say it never returns null.