Reputation: 31086
What's the difference between this.getClass().getClassLoader().getResource() and ClassLoader#getResource() ?
Frank
Upvotes: 0
Views: 1504
Reputation: 258
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);
}
Upvotes: 1
Reputation: 1108712
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.
Upvotes: 2