I always had confusion between Interface and abstract class and also that “AN INTERFACE IS 100% Abstraction”. Yesterday I was reading SCJP Certification Guide so I understand why an Interface is 100 % Abstraction and what’s the other differences between them. So I just like to share with you people, although many of you are well known about this before.
When you create an interface, you're defining a contract for what a class can do, without saying anything about how the class will do it.
Think of an interface as a 100-percent abstract class. Like an abstract class,
an interface defines abstract methods that take the following form:
abstract void bounce(); // Ends with a semicolon rather than
// curly braces
But while an abstract class can define both abstract and non-abstract
methods, an interface can have only abstract methods. Another way interfaces differ from abstract classes is that interfaces have very little flexibility in how the methods and variables defined in the interface are declared. These rules are strict:
1. All interface methods are implicitly public and abstract. In other words, you do not need to actually type the public or abstract modifiers in the method declaration, but the method is still always public and abstract.
2. All variables defined in an interface must be public, static, and final—
in other words, interfaces can declare only constants, not instance variables.
3. Interface methods must not be static.
4. Because interface methods are abstract, they cannot be marked final,
strictfp, or native.
5. An interface can extend one or more other interfaces.
6. An interface cannot extend anything but another interface.
7. An interface cannot implement another interface or class.
These are some strictly rolls apply on an Interface. Hope it will help you to understand Interface.