Interface Inheritance Java

An Interface declaration consists of modifiers, the keyword interface, the interface name, a comma-separated list of parent interfaces, and the interface body. For example:



public interface GroupedInterface extends Interface1, Interface2, Interface3
{

    // constant declarations
    
    // base of natural logarithms
    
    double E = 2.718282;
 
    // method signatures
    
    void doSomething (int i, double x);
    int doSomethingElse(String s);
}
   

The public access specifier indicates that the interface can be used by any class in any package. If you do not specify that the interface is public, then your interface is accessible only to classes defined in the same package as the interface.

An interface can extend other interfaces, just as a class subclass or extend another class. However, whereas a class can extend only one other class, an interface can extend any number of interfaces. The interface declaration includes a comma-separated list of all the interfaces that it extends.

The Interface Body

The interface body can contain abstract methods, default methods, and static methods. An abstract method within an interface is followed by a semicolon, but no braces. Default methods are defined with the default modifier, and static methods with the static keyword. All abstract, default, and static methods in an interface are implicitly public, so you can omit the public modifier.

In addition, an interface can contain constant declarations. All constant values defined in an interface are implicitly public, static, and final.

References : Oracle share on :        :  

Love to hear your Views / Guidance / Recommendations on this Post…

Explore the Technology World

Real Time Analytics with Spring Application Development FrameworkSpring is the most popular application development framework for enterprise Java.Millions of developers use Spring to build simple, truly portable, fast and fle ...Read MorePath Setting in Java When an application is launched from command prompt Windows OS searches for the executable program in the current working directory. The prompt throws an error ...Read MorePicture-in-Picture App for Android devices with Source CodePicture-in-Picture is a special type of multi-window mode mostly used for video playback for Android devices.Released under Apache License 2.0 , which means you ...Read Moreopen source free template for personal or company blogsLooking for perfect theme for personal or company blogs.Released under the MIT license, which means you can use this template for any purpose, even for commerci ...Read MoreHow to Build an App for the Google AssistantApps for the Google Assistant are the gateway for your users to engage with your services through Google Home, Android phones, iPhones.Watch here to build an as ...Read MoreIntroduction to AMP - Accelerated Mobile PagesAMP, short for Accelerated Mobile Pages, is new new open source initiative to make the mobile web awesome again.Watch Here the Introduction to AMP ...Read MoreFacebook |Google+ | Twitter | LinkedIn | Youtube About | Cookies-Policy | Disclaimer | Site Map | Contact

Call / Visit for New Batch

Services

Why Join Us

  • ➯ Free Demo Classes
  • ➯ No Registration Fee
  • ➯ Interview Questions
  • ➯ Study Materials
  • ➯ Softwares
  • ➯ Aptitude & Reasoning
  • ➯ Placement Assitance

Address

  • MyJava Training Institute ,
  • Plot No.243 , shop No 14 ,
  • Secnd Floor , Zone-II ,
  • M.P.Nagar , Bhopal,
  • Madhya Pradesh ( 462011 )
  • ☎  08871209400 , 7987028543
  • 🌐 www.myjava.in
FacebookGoogle +TwitterYouTube

MyJava - java Training Institute