I came across a code, and 1 thing stumped me. Here is the code
static public Return fun1()
{
  return new register(new SomeMap[]{
         null, 
         new SomeMap(new Basic(String.class), new Basic(String.class))
  })
  { 
    @Override
    public Return getSomething(int val)
    {
     ....
    }
  };
}
As you can see the override callback method is defined outisde the scope of new register(..). The call back function seems to be defined outside within its own code block. Is this possible? How does this work?
) is before the function override.
Shouldn't it be like this?
static public Return fun1()
    {
      return new register(new SomeMap[]{
             null, 
             new SomeMap(new Basic(String.class), new Basic(String.class))
      }
      
        @Override
        public Return getSomething(int val)
        {
         ....
        }
      );
    }
public static class register extends SomeMap
{
   public register(SomeMap[] somemaps)
   {
   }
    public Return getSomething(int val)
    {
     ....
    }
}
public static abstract class SomeMap
{
   // no constructors here just some method definitions here
}
 
    