简体   繁体   中英

Why does interface pages in java documentation have method summary ?

Is a class(for eg: A ) internally defined which implements the interface ? Does the method summary shown in interface pages of Java Documentation is actually the implementation done by the class A whose implementation is hidden from us ?

For Example :

interface Path { void help();}
class PathImpl implements Path {
  String path;
  PathImpl(String path) { this.path = path; }
  void help(){ System.out.println("Help");}
}

The Path interface documentation has method summary . Is there a hidden class PathImpl which implements every method in Path ? Is the method summary shown in online documentation actually the method implementations done in PathImpl which is hidden from us ?

It just shows the interface of its methods, which every implementer class should follow. For example, if you look at the javadoc for java.util.List, you will see how every method is used, but you don't see the actual implemention, which is left to each implementer class as ArrayList, as far as it respect the interface of List.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM