File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Interface

 
shashank dwivedi
Ranch Hand
Posts: 63
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why variables inside interface are static while methods are not?
 
sharma ishu
Ranch Hand
Posts: 70
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
because interface methods are abstract and you can't use static+abstract on a method.
Or you can say since static methods can't be overridden you must override a method in interface so you can't use static with interface methods.
 
Ramesh Pramuditha Rathnayake
Ranch Hand
Posts: 178
2
Java MySQL Database Netbeans IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't make an object from java interface. Therefore, if the variable are not static, you can never refer them..!

You can't over-ride static methods. That's why we can't write 'static' abstract methods. Methods in an interface are implicitly abstract..
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic