for example
public class Test
{
static
{
interface ITest
{}
}
}
Here the interface ITest is declare within the static block... The purpose is to know why this happening Interfaces are inherently static then why it can not be declared in static block
========================================================================= Contrary, I checked for below case and it shows no error.
public class Test
{
interface ITest
{}
}
If someone can really point out the difference due to which there is error in one case and not in second case, then it would be great help.
You cannot have a structure definition (class, interface, enum, annotation def, ...) in an executable block of code. The only exception is inner class.