Interfaces (The Java™ Tutorials > Learning the Java Language ...
Popularity Report
![]() |
|||
![]() |
|||
![]() |
|||
![]() |
|||
![]() |
|||
![]() |
Bookmark History
Saved by 3 people (0 private), first by anonymouse user on 2007-03-28
- Vaish1910 on 2008-09-13 - Tags no_tag
- Redertseng on 2007-12-21 - Tags interface , java
- Mukeshsoni on 2007-03-28 - Tags no_tag
Public Sticky notes
Interfaces as APIs
The robotic car example shows an interface being used as an industry standard Application Programming Interface (API). APIs are also common in commercial software products. Typically, a company sells a software package that contains complex methods that another company wants to use in its own software product. An example would be a package of digital image processing methods that are sold to companies making end-user graphics programs. The image processing company writes its classes to implement an interface, which it makes public to its customers. The graphics company then invokes the image processing methods using the signatures and return types defined in the interface. While the image processing company's API is made public (to its customers), its implementation of the API is kept as a closely guarded secret—in fact, it may revise the implementation at a later date as long as it continues to implement the original interface that its customers have relied on.Highlighted by mukeshsoni
objects can have multiple types:
the type of their own class and the types of all the interfaces that they implement. This means that if a variable is
declared to be the type of an interface, its value can reference any object that is instantiated from any class that
implements the interface.
Highlighted by mukeshsoni
There are a number of situations in software engineering when it is
important for disparate groups of programmers to agree to a "contract"
that spells out how their software interacts. Each group should be able to write their code
without any knowledge of how the other group's code is written.
Generally speaking, interfaces are such contracts.
Highlighted by vaish1910
interfaces are such contracts.
Highlighted by redertseng
In the Java programming language, an interface is a reference type, similar to a class, that can contain only
constants, method signatures, and nested types.
Highlighted by redertseng
Interfaces cannot be instantiated—they
can only be implemented by classes or extended by other interfaces.
Highlighted by redertseng
Note that the method signatures have no braces and are terminated with a semicolon.
Highlighted by redertseng
objects can have multiple types:
Highlighted by vaish1910
This means that if a variable is
declared to be the type of an interface, its value can reference any
Highlighted by vaish1910
object that is instantiated from any class that
implements the interface.
Highlighted by vaish1910


Public Comment