File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Programmer Certification (SCJP/OCPJP)
Joined: Mar 06, 2012
Feb 01, 2013 03:58:07
why variables inside interface are static while methods are not?
Joined: Sep 10, 2012
Feb 01, 2013 06:23:15
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
Joined: Oct 31, 2012
Feb 06, 2013 09:24:31
You can't make an object from
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:
Writing an Interface
How To Call Two Different Classes From the Main Program Using the Same API?
Home interface or Home Interface stub
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014