Declaring a method inside a method: Runnable?
Code:
public class SomeClass {
public void sayHello ( ) {
final Runnable greeter = new Runnable ( ) { public void run ( ) {
System.out.println("Hello"); System.out.println("Good Morning");
System.out.println("How Are You"); } } ;
greeter.run() ; // first time
greeter.run() ; // second time
}//sayHello() closes
}//SomeClass closes here
I have come across a blog in which it is claimed that using the above detailed technique on can run a method inside a method. Is this true. If it is can some take a moment to explain the code above.