• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

static interfaces

 
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are interfaces automatically static?
 
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Mathew Kuruvilla:
Are interfaces automatically static?



Where did you read this?!
 
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i know interfaces by default are abtract and public. I know we do have static interfaces too...but im not sure if they are static by default. Another thing what Im sure about is you cant declare static methods in an interface.

hmmm...finally I didnt answer your question huh.... :-)

Preetham
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Section 8.1.2 of the Java Language Specification states, "Member interfaces ... are always implicitly static..."

Ref: http://java.sun.com/docs/books/jls/second_edition/html/jTOC.doc.html

Because they're implicitly static, nested interfaces can be implemented without an instance of the enclosing class. (Top-level interfaces are another matter. I don't see that "static" would have any meaning in that context.)
[ December 02, 2004: Message edited by: marc weber ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic