The code is
this.getClass().getResource(filename);and the main part i am confused about is: this.getClass()
It is used in this context:
public class PlayMusic extends Applet {
String filename = "woah.wav";
Sequence song;
private URL getURL(String filename){
URL url = null;
try{
url = this.getClass().getResource(filename);
}
catch(Exception e){
System.out.println("Exception : " + e);
}
return url;
}
Well if someone could explain the use and what this.getClass() does (and why it's needed) i would be greatful, i like to know what and why i am using code, and so far i can't find anything on the tinterweb to explain it.
Thanks
-fedexer-

New Topic/Question
Reply




MultiQuote






|