Results 1 to 6 of 6

Thread: Interfaces in java

  1. #1
    puneet167
    Guest

    Default Interfaces in java

    Interfaces provide more sophisticated ways to organize and control the objects in your system.
    The interface keyword takes the abstract concept one step further. You could think of it as a “pure” abstract
    class. It allows the creator to establish the form for a class: method names, argument lists, and return
    types, but no method bodies. An interface can also contain fields, but The interface keyword takes the
    abstract concept one step further. You could think of it as a “pure” abstract class. It allows the creator to
    establish the form for a class: method names, argument lists, and return types, but no method bodies.
    An interface can also contain fields, but
    An interface says: “This is what all classes that implement this particular interface will look like.” Thus,
    any code that uses a particular interface knows what methods might be called for that interface, and that’s
    all. So the interface is used to establish a “protocol” between classes. (Some object-oriented programming
    languages have a keyword called protocolto do the same thing.)

  2. #2
    Enthusiast amadarock's Avatar
    Join Date
    Jun 2011
    Location
    secunderabad
    Posts
    42

    Default

    hi
    An interface in the Java programming language is an abstract type that is used to specify an interface (in the generic sense of the term) that classes must implement. Interfaces are declared using the interface keyword, and may only contain method signatures and constant declarations (variable declarations that are declared to be both static and final). An interface may never contain method definitions.

    Interfaces cannot be instantiated. A class that implements an interface must implement all of the methods described in the interface, or be an abstract class. Object references in Java may be specified to be of an interface type; in which case, they must either be null, or be bound to an object that implements the interface.

    One benefit of using interfaces is that they simulate multiple inheritance. All classes in Java (other than java.lang.Object, the root class of the Java type system) must have exactly one base class; multiple inheritance of classes is not allowed. Furthermore, a Java class may implement, and an interface may extend, any number of interfaces; however an interface may not implement an interface.

    by
    amadarock

  3. #3

    Default

    Interface is a very innovating concept . It helps in removing the DOD problem in c++ nad also implements the concept of multiple inheritance .


  4. #4

    Default

    It allows the creator to establish the form for a class: method names, argument lists, and return
    types, but no method bodies.

  5. #5

    Default

    Interfaces are one type of abstract parts of JAVA which can be defined by "interface_name". It can work as multiple inheritance but it's not the inheritance. Many times, it works for recall system into Java programming.
    Last edited by brainusa; 10-09-12 at 03:58 PM.

  6. #6
    New Member rosyhyden's Avatar
    Join Date
    Dec 2013
    Location
    Gurgaon
    Posts
    2

    Default

    nice discussion on interface

    An interface is a blueprint of a class. It has static constants and abstract methods. The interface is a mechanism to achieve fully abstraction in java. There can be only abstract methods in the interface. It is used to achieve fully abstraction and multiple inheritance in Java. Interface also represents IS-A relationship. It cannot be instantiated just like abstract class.

Similar Threads

  1. Java or PHP?
    By techkriti in forum Java
    Replies: 42
    Last Post: 10-12-12, 04:45 PM
  2. About Java Language
    By martinshook in forum Javascript
    Replies: 16
    Last Post: 05-07-12, 07:50 PM
  3. arrays in java....
    By ammuthalib123 in forum Java
    Replies: 10
    Last Post: 06-04-12, 04:23 PM
  4. Framework in java
    By aprakash7 in forum Open Source
    Replies: 5
    Last Post: 04-11-11, 08:19 PM
  5. preparing for java
    By hennamullaji in forum Education News
    Replies: 0
    Last Post: 20-01-08, 10:58 PM

Share this page with your friends

Share this page with your friends

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •