-
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 <leodeegan@hotmail.com> wrote in message
news:39170d94$1@news.devx.com...
>
> Why is it not possible to have a static block in an interface to
initialize
> 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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks