static blocks in interfaces?
Why is it not possible to have a static block in an interface to initialize
the interface's (implicitly) public static final member variables?
Re: static blocks in interfaces?
leo <email@example.com> wrote in message
> Why is it not possible to have a static block in an interface to
> the interface's (implicitly) public static final member variables?
Perhaps you should address your question to the architects of Java instead
of to us mere mortals. But in answer to your question, my guess is that
interface definitions can't include executable code. Why not? Because when
you implement an interface, all that happens is that you agree to provide
methods with specific names and parameter lists. You don't inherit from any
class. I'm guessing that the interface class you implemented doesn't get
loaded by the JVM, so its static initializers would never be run.
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center