For the code above, how to call the nowsee method in the main function ?
Regards,<br />Pradeep Balasubramanian<br /> <br />You have to grow from the inside out. None can teach you, none can make you spiritual. There is no other teacher but your own soul. <br /> <br />- Swami Vivekananda
posted 8 years ago
You can't call the method from main function. Anonymous classes are used to pass a specific implementation as an argument of a method. In your code, doStuff() method will be able to invoke nosee() method to perform some stuff but you can't access nosee() method from main.
You will understand better the concepts (why and when using anonymous classes) in chapter about Threads: there are a lot of examples regarding anonymous classes (implementation of a specific run() method from Runnable interface )
SCJP 5, SCWCD 5
bacon. tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user