Java return method from inside anonymous inner class -
i have method called play()
. inside of class, have timer
(java.util.timer
), , anonymous inner class of type timertask
. here code:
public static void play() { new timer().schedule(new timertask() { public void run() { ... }, 0, 100); // run every 10 milliseconds starting in 0 milliseconds (immediately) }
now question is... wish return method play
inside anonymous inner class (within ...
), if call "return
", return "run
" method inside inner class. how return play
method inside of anonymous inner class?
[the title isn't clear; couldn't phrase well. please edit title if can think of better title.]
the function play
should return immediatly, since timer operates on thread, there no need return outside inner class.
Comments
Post a Comment