interfaces

interfaces

how we can define relationship between simple classes & interfaces.

View Answers

April 23, 2011 at 11:32 AM

An interface declaration introduces a new reference type whose members are classes, interfaces, constants and abstract methods. This type has no implementation, but otherwise unrelated classes can implement it by providing implementations for its abstract methods. A class may be declared to directly implement one or more interfaces, meaning that any instance of the class implements all the abstract methods specified by the interface or interfaces.

Here is an example:

interface IntefaceA{
      void method1();
}
interface InterfaceB{
      void method2();
}
interface Interface extends IntefaceA,InterfaceB {
  void method3();
}
class InterfaceExample implements Interface {
  public void method1() {
    System.out.println("Method1.....");
  }
  public void method2() {
    System.out.println("Method2.....");
  }
  public void method3() {
    System.out.println("Method3.....");
  }
  public static void main(String arg[]) {
    InterfaceExample ex = new InterfaceExample();
    ex.method1();
    ex.method2();
    ex.method3();
  }
}









Related Tutorials/Questions & Answers:
interfaces
& interfaces.   An interface declaration introduces a new reference type whose members are classes, interfaces, constants and abstract methods... to directly implement one or more interfaces, meaning that any instance of the class
Interfaces in flex
Interfaces in flex  Hi..... Please tell me about... What are - IStyleClient, IChildList, ILayoutManager, IToolTipManagerClient, IInvalidating, IValidatorListener, IFlexModule, IAutomationObject, IPropertyChangeNotifier
Advertisements
Marker interfaces in java
Marker interfaces in java  how marker interfaces work
EJB Interfaces
EJB Interfaces       Interface... interfaces. These are as follows 1)Remote interface:- Remote interface..., RemoteException; } 4)Localhome Interface:-The local interfaces extend
What are Callback interfaces?
What are Callback interfaces?  Hi, What are Callback interfaces? thanks, (adsbygoogle = window.adsbygoogle || []).push
ModuleNotFoundError: No module named 'interfaces'
ModuleNotFoundError: No module named 'interfaces'  Hi, My Python... 'interfaces' How to remove the ModuleNotFoundError: No module named 'interfaces' error? Thanks   Hi, In your python environment you
Hibernate Callback interfaces
Hibernate Callback interfaces  What are Callback interfaces?   Callback interfaces allow the application to receive a notification when something interesting happens to an object?for example, when an object is loaded
Interfaces - Java Interview Questions
Interfaces  two interfaces having same method names and these two interfaces are implemented by a single class. so now i would like to generate different code of same methods of different interfaces. eg: ---- interface i1
Interfaces - Java Interview Questions
Interfaces  two interfaces having same method names and these two interfaces are implemented by a single class. so now i would like to generate different code of same methods of different interfaces in single class? my query
java interfaces implementation
java interfaces implementation  hai I have defined one inter face like Maths taking methods like add(), sub(), mul()in interface I take different implementation classes for add() method and sub()and mul
how to create interfaces in java
how to create interfaces in java  HI, Here is my code public interface validateInfo { public void validate(String empcode, String password); } class updateInfo implements validateInfo { public void update() { //code
interfaces - Java Beginners
interfaces  What is the mechanism going behind when an interface extends another interface?in case of classes when a sub class extends super class, super class constructor runs.what about interfaces?  Hi Friend
What are the Core interfaces are of Hibernate framework?
What are the Core interfaces are of Hibernate framework?  Hi, What are the Core interfaces are of Hibernate framework? Thanks, (adsbygoogle = window.adsbygoogle || []).push
ModuleNotFoundError: No module named 'ICD-Interfaces'
ModuleNotFoundError: No module named 'ICD-Interfaces'  Hi, My... named 'ICD-Interfaces' How to remove the ModuleNotFoundError: No module named 'ICD-Interfaces' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'masonite-interfaces'
ModuleNotFoundError: No module named 'masonite-interfaces'  Hi, My... named 'masonite-interfaces' How to remove the ModuleNotFoundError: No module named 'masonite-interfaces' error? Thanks   Hi
ModuleNotFoundError: No module named 'network_interfaces'
ModuleNotFoundError: No module named 'network_interfaces'  Hi, My... named 'network_interfaces' How to remove the ModuleNotFoundError: No module named 'network_interfaces' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'OctoBot-Interfaces'
ModuleNotFoundError: No module named 'OctoBot-Interfaces'  Hi, My... named 'OctoBot-Interfaces' How to remove the ModuleNotFoundError: No module named 'OctoBot-Interfaces' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'OctoBot-Interfaces'
ModuleNotFoundError: No module named 'OctoBot-Interfaces'  Hi, My... named 'OctoBot-Interfaces' How to remove the ModuleNotFoundError: No module named 'OctoBot-Interfaces' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'primitive_interfaces'
ModuleNotFoundError: No module named 'primitive_interfaces'  Hi...: No module named 'primitive_interfaces' How to remove the ModuleNotFoundError: No module named 'primitive_interfaces' error? Thanks   Hi
ModuleNotFoundError: No module named 'python-interfaces'
ModuleNotFoundError: No module named 'python-interfaces'  Hi, My... named 'python-interfaces' How to remove the ModuleNotFoundError: No module named 'python-interfaces' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'reahl-interfaces'
ModuleNotFoundError: No module named 'reahl-interfaces'  Hi, My... named 'reahl-interfaces' How to remove the ModuleNotFoundError: No module named 'reahl-interfaces' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'robokop-interfaces'
ModuleNotFoundError: No module named 'robokop-interfaces'  Hi, My... named 'robokop-interfaces' How to remove the ModuleNotFoundError: No module named 'robokop-interfaces' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'storage_interfaces'
ModuleNotFoundError: No module named 'storage_interfaces'  Hi, My... named 'storage_interfaces' How to remove the ModuleNotFoundError: No module named 'storage_interfaces' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'strict-interfaces'
ModuleNotFoundError: No module named 'strict-interfaces'  Hi, My... named 'strict-interfaces' How to remove the ModuleNotFoundError: No module named 'strict-interfaces' error? Thanks   Hi, In your
interfaces,exceptions,threads
interfaces,exceptions,threads  SIR,IAM JAVA BEGINER,I WANT KNOW THE COMPLETE CONEPTS OF INTERFACES,EXCEPTIONS,THREADS   Interface An interface is one which has abstract methods(not defined just declared)and static
Version of com.codnos>dbgp-interfaces dependency
List of Version of com.codnos>dbgp-interfaces dependency
Hibernate: core interfaces of hibernate framework
Hibernate: core interfaces of hibernate framework  What are the core interfaces of hibernate framework   Most of hibernate based application code deals with following interfaces provided by the Hibernate Core
Version of excalibur-instrument-manager-interfaces>excalibur-instrument-manager-interfaces dependency
List of Version of excalibur-instrument-manager-interfaces>excalibur-instrument-manager-interfaces dependency
Collection Interfaces
Collection Interfaces     ... of several interfaces, and classes that implement those interfaces, contained within... of objects.  Different interfaces describe different types of functionalities
EJB Interfaces
EJB Interfaces       Interface... interfaces. These are as follows 1)Remote interface:- Remote interface..., RemoteException; } 4)Localhome Interface:-The local interfaces extend
What are Classes and Interfaces in Java?
In this tutorial we are going to discuss about classes and interfaces in Java... and interfaces concepts in detail. What are classes? Java is Object oriented...; What are interfaces? (adsbygoogle = window.adsbygoogle || []).push
Interfaces and Abstract Classes - Development process
Interfaces and Abstract Classes  What are the Scenarios where we use Interface and Abstract Classes?  Hi Friend, Interface: Java does... by using the interface. Interfaces are useful when you do not want classes
Artifacts of excalibur-instrument-manager-interfaces
List of Artifacts of excalibur-instrument-manager-interfaces maven depenency
Jep's Rich User Interfaces blog
Jep's Rich User Interfaces blog       About AJAX Performance and some other things by Jep Castelein of Backbase Read full DescriptionADS_TO_REPLACE_1
ModuleNotFoundError: No module named 'debian-interfaces-parser'
ModuleNotFoundError: No module named 'debian-interfaces-parser'  Hi...: No module named 'debian-interfaces-parser' How to remove the ModuleNotFoundError: No module named 'debian-interfaces-parser' error? Thanks  
ModuleNotFoundError: No module named 'debian-interfaces-parser'
ModuleNotFoundError: No module named 'debian-interfaces-parser'  Hi...: No module named 'debian-interfaces-parser' How to remove the ModuleNotFoundError: No module named 'debian-interfaces-parser' error? Thanks  
ModuleNotFoundError: No module named 'jderobot-interfaces-kibotics'
ModuleNotFoundError: No module named 'jderobot-interfaces-kibotics'  ...: No module named 'jderobot-interfaces-kibotics' How to remove the ModuleNotFoundError: No module named 'jderobot-interfaces-kibotics' error
ModuleNotFoundError: No module named 'jderobot-interfaces-python'
ModuleNotFoundError: No module named 'jderobot-interfaces-python'  Hi...: No module named 'jderobot-interfaces-python' How to remove the ModuleNotFoundError: No module named 'jderobot-interfaces-python' error? Thanks
ModuleNotFoundError: No module named 'odoo10-addons-oca-connector-interfaces'
ModuleNotFoundError: No module named 'odoo10-addons-oca-connector-interfaces...: ModuleNotFoundError: No module named 'odoo10-addons-oca-connector-interfaces' How...-interfaces' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'odoo11-addons-oca-connector-interfaces'
ModuleNotFoundError: No module named 'odoo11-addons-oca-connector-interfaces...: ModuleNotFoundError: No module named 'odoo11-addons-oca-connector-interfaces' How...-interfaces' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'odoo9-addons-oca-connector-interfaces'
ModuleNotFoundError: No module named 'odoo9-addons-oca-connector-interfaces...: ModuleNotFoundError: No module named 'odoo9-addons-oca-connector-interfaces' How...-interfaces' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'pyros-interfaces-ros'
ModuleNotFoundError: No module named 'pyros-interfaces-ros'  Hi...: No module named 'pyros-interfaces-ros' How to remove the ModuleNotFoundError: No module named 'pyros-interfaces-ros' error? Thanks   Hi
ModuleNotFoundError: No module named 'py-ts-interfaces'
ModuleNotFoundError: No module named 'py-ts-interfaces'  Hi, My... named 'py-ts-interfaces' How to remove the ModuleNotFoundError: No module named 'py-ts-interfaces' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'py-ts-interfaces'
ModuleNotFoundError: No module named 'py-ts-interfaces'  Hi, My... named 'py-ts-interfaces' How to remove the ModuleNotFoundError: No module named 'py-ts-interfaces' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'py-ts-interfaces'
ModuleNotFoundError: No module named 'py-ts-interfaces'  Hi, My... named 'py-ts-interfaces' How to remove the ModuleNotFoundError: No module named 'py-ts-interfaces' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'py-ts-interfaces'
ModuleNotFoundError: No module named 'py-ts-interfaces'  Hi, My... named 'py-ts-interfaces' How to remove the ModuleNotFoundError: No module named 'py-ts-interfaces' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'd3m-primitive-and-type-interfaces'
ModuleNotFoundError: No module named 'd3m-primitive-and-type-interfaces' ...: ModuleNotFoundError: No module named 'd3m-primitive-and-type-interfaces' How to remove the ModuleNotFoundError: No module named 'd3m-primitive-and-type-interfaces'
ModuleNotFoundError: No module named 'jderobot-interfaces-kibotics'
ModuleNotFoundError: No module named 'jderobot-interfaces-kibotics'  ...: No module named 'jderobot-interfaces-kibotics' How to remove the ModuleNotFoundError: No module named 'jderobot-interfaces-kibotics' error
ModuleNotFoundError: No module named 'odoo10-addons-oca-connector-interfaces'
ModuleNotFoundError: No module named 'odoo10-addons-oca-connector-interfaces...: ModuleNotFoundError: No module named 'odoo10-addons-oca-connector-interfaces' How...-interfaces' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'odoo8-addons-oca-connector-interfaces'
ModuleNotFoundError: No module named 'odoo8-addons-oca-connector-interfaces...: ModuleNotFoundError: No module named 'odoo8-addons-oca-connector-interfaces' How...-interfaces' error? Thanks   Hi, In your python environment you

Ads