Java Interface


            Interface is a keyword of Java language that create block to hold constant and abstract methods.

            Whenever any variable or object is declared in interface block then its necessary to initialize the value of that variable or object such declared variable or object is known as constant of interface block.

            Whenever any proto type of method (signature of method) declared in interface block then that method becomes the abstract method from the interface block and it is necessary for the subclass to implement the body of obstruct method declare in the super interface body of abstract method should have public access specified.

Rules to Create interface

  1. It should not contain any body of method.
  2. It should not contain constructor.
  3. Uninitialized variable are not allowed in interface.
  4. We can not directly create the object of interface using new operator.

Leave a Reply

Your email address will not be published. Required fields are marked *