This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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
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 )