Yes, it's perfectly legal. The class is not an "inner" class, it is a "nested" (static) class.
Beware that this is very uncommon and quite never used (unless in extreme/particular designs). So...