Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

static interface

 
meeta gaur
Ranch Hand
Posts: 305
Notepad Tomcat Server Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
public static interface WatchEvent.Kind<T>

http://docs.oracle.com/javase/7/docs/api/java/nio/file/WatchEvent.Kind.html

Interfaces are static ?
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If it's nested, yes. Why would you think it couldn't be? You're aware nested classes can be static, right?
 
meeta gaur
Ranch Hand
Posts: 305
Notepad Tomcat Server Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeff Verdegan wrote:If it's nested, yes. Why would you think it couldn't be? You're aware nested classes can be static, right?


I'm wondering because below post says ,

One cannot declare a top-level interface as static, but can do so within a class. You can have a static/non-static class in an interface.
[ June 18, 2008: Message edited by: Sidharth Pallai ]


http://www.coderanch.com/t/385650/java/java/static-interface

 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
meeta gaur wrote:

I'm wondering because below post says ,

One cannot declare a top-level interface as static, but can do so within a class. You can have a static/non-static class in an interface.
[ June 18, 2008: Message edited by: Sidharth Pallai ]


http://www.coderanch.com/t/385650/java/java/static-interface



I still don't see what you're confused about. The interface you're referring to is not top-level, but is nested within a class, just as that quote describes.
 
meeta gaur
Ranch Hand
Posts: 305
Notepad Tomcat Server Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you
 
Rajdeep Biswas
Ranch Hand
Posts: 216
1
Eclipse IDE Java Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Remember, only class level members can be declared static. I mean somehting like:
And so does the interface that you have mentioned.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic