What's the difference between this.getClass().getClassLoader().getResource() and ClassLoader#getResource() ?
Frank
The first is the actual code, the second is just a pointer which class/method you should use.
By the way, you should rather have asked this minor question/request-for-clarification in a comment on my answer in your previous question .
You mean difference between " Class #getResource()" and " ClassLoader #getResource()"? If you look at JVM srcs (recommended), you will see that the first is a convenience wrapper method around the latter:
public java.net.URL getResource(String name) {
name = resolveName(name);
ClassLoader cl = getClassLoader0();
if (cl==null) {
// A system class.
return ClassLoader.getSystemResource(name);
}
return cl.getResource(name);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.