Normally "java.lang.reflect.InvocationTargetException" occurs when java compiler finds 2 different classes with same name in 2 different packages. when u r importing both classes at a time and when you r trying to create object of that class it throws "java.lang.reflect.InvocationTargetException" exception .
The solution is that when you are creating the object of the class use package name also along with class name so that compiler knows what class it has to use.
The solution is that when you are creating the object of the class use package name also along with class name so that compiler knows what class it has to use.
本文探讨了在Java中遇到的java.lang.reflect.InvocationTargetException异常的原因及解决方案。当两个不同包中存在同名类时,可能会引发此异常。文章提供了一种通过指定完整包名来创建对象的方法,以此避免编译器混淆。
1322

被折叠的 条评论
为什么被折叠?



