I don't think so. Post the print out here and I'll show you.
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
I don't think so. Post the print out here and I'll show you.
run this=Bluemoon.PlaySound$1@1d23e75
run this=Bluemoon.PlaySound$1@1d23e75
The full class name is Bluemoon.PlaySound$1
The $1 is for the inner class that run is in.
If run were in the PlaySound class, the output would be something like this:
run this=Bluemoon.PlaySound@1d23e75
Notice no $1
If you look in the folder with the class files you will see two class files:
12/21/2011 01:53 PM 4,555 PlaySound$1.class <<<<<<< The inner class with run()
12/21/2011 01:53 PM 1,379 PlaySound.class <<<< The PlaySound class
I'm a noob but how would this help me? Would i changetoPlaySound s = new PlaySound();Because i tried that and it didn't work.PlaySound$1 s = new PlaySound$1();
In the PlaySound class, is there a variable/reference to the inner class that has the run() method?
Is it public? Can you use it from another class?
Think about what this statement does and how it is put together:
System.out.println()
<Classname>.<static variable>.<methodname>()
Last edited by Norm; December 21st, 2011 at 02:15 PM.
No how would i make that variable?
The PlaySound class has it.how would i make that variable?
Where did you copy the code from? It was not written to do what you want. It should be rewritten for you to be able to use it as you are trying.
Take the code out of the run() method and make a new method that plays sounds. Get rid of the Thread and Runnable stuff.
Archibold9 (December 21st, 2011)
Okay thanks for your help. I'll go do it now >.<