It may be special, it may not be.
You are viewing a local class that is available as part of the method:
class Foo { static void bar(){ class MyRunnable implements Runnable { public void run() { System.out.println("No longer anonymous!"); } }; Thread baz = new Thread(new MyRunnable()); } }
I saw the use of inner classes anonymous as:
class Foo { static void bar(){ Thread baz=new Thread(new Runnable(){ public void run(){ System.out.println("quux"); } } } }
This is technically an inner class (albeit anonymous) and is defined by the static method. I personally would create a static nested class that implements Runnable and does:
baz = new Thread(new MyRunnable());
where MyRunnable is defined as:
class Foo { static void bar(){
hexafraction
source share