Some Useful Rules For Interface

As I found some Rules for Java Interfaces, which is very useful for any java programmer, I am publishing it here. If you have some more idea please do send me.

The rules go like this:

  • The entire interface is implicitly public and abstract. That means, we do not need to type public or abstract modifier in the member methods.
  • All variable defined in a interface must be public, static, and final. That means, interface can define only constant not instance variable.
  • Interface method must not be static.
  • As interface methods are abstract, they cannot be marked final, strictfp, or native.
  • An interface can extend one or more other interfaces.
  • An interface cannot extend anything but another interface.
  • An interface cannot implement another interface or class.
  • An interface must be declared with the keyword interface.
  • Interface types can be used polymorphically

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: