Local variables can't have any modifiers except final. It is not for main only if you try something like
The above mentioned code won't compile, because static can't be applied to local variables. Additionally static variables
are class variables and not related to any instance. In your example, it was a local variable and static is not allowed with it.
Local method variables cannot be static, which would make them stick around without a class
instance, because they disappear from the stack when the method returns. Also by default,
they are private to the method and cannot be accessed from above or below; from calling or
called methods. So access modifiers public, protected and private don't make sense for local
variables either (or parameter passing variables).