While I am using reflection I came upon this error. I have a class named Test1, and when I try to get a Class object of it by entering test1 as input to Class.forName() it generates LinkageError instead of ClassNotFoundException. Why does the lower-case letter confuse the program and prevent it from generating the usual ClassNotFoundException as with for example "sjghdjgh"?
Minimal example
Main
public class Main {
public static void main(String[] args) {
try {
Class.forName("test1");
}
catch (ClassNotFoundException cnfe) {
System.out.println(cnfe.toString());
}
catch (LinkageError le) {
System.out.println(le.toString());
}
}
}
Test1
public class Test1 {
}