c3 = Class.forName("com.imooc.reflet.Foo");這個(gè)我運(yùn)行之后為什么老是有錯(cuò)啊?
錯(cuò)誤是這樣的,求賜教:
true
java.lang.ClassNotFoundException: com.ioomc.reflect.Foo
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:259)
at com.imooc.reflet.ClassDemo1.main(ClassDemo1.java:28)
false
您好,歡迎調(diào)用我!
2018-08-16
要用try catch包圍
2018-06-01
"com.imooc.reflet.Foo"
你沒有這個(gè)類?