Interface concepts.

Hi,
I saw this from a book but dont understand what it means:
public interface RemoteStudent extends Remote {
public abstract int getStudentID() throws remoteException;
What is the meaning of "abstract" word doing here ? Thanks.
Ken

Hi,
Thanks for the explanation. This is the reason I come to New to java forums. The thing puzzles me is that an abstract class may has an abstract method. But, in this case, an abstract keyword is putting inside an interface.
1) So, my question is, in this case, I have no abstract class. I only see this interface with abstract keyword in it. So, if a class implements this interface, does this class needs to provide an implementation for this abstract method or not ?
2) What if, there are many abstracts methods in this interface, and there are bunch of classes implementing this interface. Does each class needs to give implementation of each abstract method ?
Thanks.
Lazy Ass Ken

Similar Messages

  • Interfaces concept in web dynpro

    Hi all
    Can anyone tell me a way of approaching the interfaces concept in web dynpro?
    Thanks n regards
    chaitanya

    Hi,
    Check this links and work on it.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/webcontent/uuid/28113de9-0601-0010-71a3-c87806865f26?rid=/library/uuid/49f2ea90-0201-0010-ce8e-de18b94aee2d#13 [original link is broken]
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/webcontent/uuid/28113de9-0601-0010-71a3-c87806865f26?rid=/library/uuid/49f2ea90-0201-0010-ce8e-de18b94aee2d#12 [original link is broken]
    http://help.sap.com/saphelp_nw70/helpdata/en/20/a5f7416e61212be10000000a155106/frameset.htm

  • Brief conclusion of Boss class and there interface concept or basic programming architecture ?

    I am new in this indesign development so i am studying the  documentation provide by sdk till date i think lots of concept are clear to me but still while doing practicle implementation many concept intermixed in my mind .one of them is "command" .so please tell me in brief about it with practical example of creating new document having text frame in indesigen using it .also there are  lots of question in my mind  regarding interface and boss class anyone please share there knowledge regarding them in brief

    Due to a copy/paste glitch, some necessary spaces have inadvertently been removed.  If I could fix this, I would.

  • Query on interface concept

    Class A{}
    Interface I{}
    public Class B
    Public static void main ( String[] xx)
    A a = new A();
    I ii = a; // it doesn?t ..
    I i = (I) a ; // it works WHY?
    // why this code compiles ?

    newbie_007 wrote:
    Class A{}
    Interface I{}
    public Class B
    Public static void main ( String[] xx)
    A a = new A();
    I ii = a; // it doesn?t ..
    I i = (I) a ; // it works WHY?
    // why this code compiles ?public class B
    public static void main ( String[] xx)
    A a = new A();
    A ii = a; // it doesn?t ..
    I i = (I) a ; // it works WHY?
    class A{}
    interface I{}
    but this compiles and I wonder too. But when I run it, it throus
    Exception in thread "main" java.lang.ClassCastException: A cannot be cast to I
         at B.main(B.java:15)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
    interesting.
    Edited by: Tiko_dev on Apr 30, 2009 7:11 AM

  • Use of interface concept

    Hi everyone !!!
    Can anyone explain me what are the uses to the interface and why do we need to use interface.
    I know one advantage is java doesn't support multiple inheritance so we need to use interface.
    By using interface what can we do ? But i dont find advantages in that
    can you explain me pls ....

    One of the most popular uses of interfaces comes out of the Collections frame works.
    For example, java.util.List, java.util.Map, and java.util.Set.
    ArrayList is an implementation of the the interface List. By abstracting ArrayList into the interface, I can now change what type of List I am working with, and my code doesn't care....
    For example, I have a method that creates an ArrayList that contains all the users on the server at a particular time. As the coder, I know the method is going to create an ArrayList. Now I have a choice, I can make the method's return type an ArrayList, or I can use the interface name and return a List:
    public ArrayList getCurrentUsers() {
      ArrayList theList = new ArrayList();
      return theList;
    -or-
    public List getCurrentUsers() {
      List theList = new ArrayList();
      return theList;
    } Both codes would be functionally equivalent. Any code that calls the first method may (but does not need to) do this:
    ArrayList currentUsers = getCurrentUsers();Whereas any code that runs the second method would need to do this:
    List currentUsers = getCurrentUsers();What's the difference? Well, let's say you decide to change your method to use a LinkedList instead of an ArrayList. If you employed method 1, you now have to make sure you change all the code that accessed the method is changed as well. But, since LinkedList is another implementation of List, if you employ method 2, you can be sure that none of the code that uses your method will break, because they only work through an interface wich both ArrayList and LinkedList share in comon.
    So Interfaces are great for defining how a class or object looks, but not necessarily how it works. If you use the List interface to look at ArrayList or LinkedList then both of these classes will look the same, they are both sure to have the same methods defined in the List interface. However, they both will act differently, based on the underlying implementation.
    In general terms, it is a level of abstraction that allows the implementer be more flexible with what he is working on, by ensuring a common means of accessing the object, or a set of rules that users must use when accessing the object. In the mean time, the coder is free to make changes, switch implementations, without affecting others.

  • Interfaces concept ...Urgent?

    Hi all,
    As we all know multiple inheritance cannot be achieved in ABAP classes, so we need to take INTERFACES approach, I am trying to do from the below mentioned code.
    *&            INTERFACE Stu_course
    INTERFACE stu_course.
      DATA : course_id.
      METHODS: max_student,
               add_student,
               drop_student.
    ENDINTERFACE.
    *&          Class cl_course
    CLASS cl_course DEFINITION ABSTRACT.
      PUBLIC SECTION.
      INTERFACES stu_course.
      PRIVATE SECTION.
      DATA : count TYPE i.
    ENDCLASS.
    CLASS cl_course IMPLEMENTATION.
      METHOD stu_course~add_student.
        WRITE: / 'Student added'.
      ENDMETHOD.
      METHOD stu_course~drop_student.
        WRITE: / 'Student Dropped'.
      ENDMETHOD.
      METHOD stu_course~max_student.
        count = count + 1.
        IF count GT 10.
        write: / 'maximum number of student reached'.
        ENDIF.
      ENDMETHOD.
    ENDCLASS.
    *&            Class cl_student
    CLASS cl_student DEFINITION. "INHERITING FROM cl_university_member.(currently not mentioned)
       PUBLIC SECTION.
       DATA : student_id type i.
       INTERFACES stu_course.
         METHODS:register_course
                  IMPORTING course TYPE REF TO cl_course,
                withdraw_course
                  IMPORTING course TYPE REF TO cl_course.
    ENDCLASS.
    CLASS cl_student IMPLEMENTATION.
    METHOD register_course.
    "Here i want to call the definition of method "add_student" of class cl_course without inheritance, so that i can achieve multiple inheritance."
    ENDMETHOD.
    ENDCLASS.
    Class cl_student wants to inherit the definition of methods like             add_student,drop_student from class cl_course.Is this posible n how?
    Thanks n Regards
    Rohit

    hi rohit,
      see below details regarding Intefaces,
         Interface
         Simple use of an interface
    Theme     This program will show simple use of an interface with its own data and methods and how it is implemented in a class. It will also show that there can be methods of same name for an interface and the class implementing the interface.
    Program Desc     This program contains an interface I1 with attribute : NUM an method : METH1.
    This interface is implemented in a class : C1 which also has its own method METH1.
    An object OREF is created from class C1 and both the methods METH1 , one for class and another for interface is called using the object.
    Dump     
    report ysubdel .
    interface i1.
    data    : num type i .
    methods : meth1.
    endinterface.
    class c1 definition.
      public section.
       methods : meth1.       “ class C1’s own method
       interfaces : i1.
    endclass.
    class c1 implementation.
      method : meth1.
       write:/5 'I am meth1 in c1'.
      endmethod.
      method i1~meth1.
       write:/5 'I am meth1 from i1'.
      endmethod.
    endclass.
    start-of-selection.
      data : oref type ref to c1.
      create object oref.
      write:/5 oref->i1~num.
      call method oref->meth1.
      call method oref->i1~meth1.
    Output               0         
    I am meth1 in c1   
    I am meth1 from i1 
         Interfaces can only be implemented in the public section of a class
    Theme     This program will show you that classes implementing an interface can only contain the features of the interface in its public section.
    Program Description     In this program, class C1 is trying to accommodate interface I1 in its PRIVATE SECTION.
    This creates a compilation error, establishing the theme.
    Dump     report ysubdel .
    interface i1.
    methods : meth1.
    endinterface.
    class c1 definition.
      protected section.
       interfaces : i1.
    endclass.
    Output     Compilation error with error message :-
    INTERFACES may only be implemented in the public section.
         A class with an interface should implement all the methods of that interface
    Theme     This program will show that a class containing an interface should implement all the methods of the interface in its implementation section.
    Program Descrip     Class C1 implements interface I1, which has got two methods , METH1 and METH2. But, in the IMPLEMENTATION section of class C1, only METH1 is implemented.
    This program will create a compilation error, establishing the theme.
    Dump     
    report ysubdel .
    interface i1.
    methods : meth1 ,
               meth2 .
    endinterface.
    class c1 definition.
      public section.
       interfaces : i1.
    endclass.
    class c1 implementation.
      method i1~meth1.
       write:/5 'I am meth1 from i1'.
      endmethod.
    endclass.
    start-of-selection.
      data : oref type ref to c1.
       create object oref.
       call method oref->i1~meth1.
    Output     Compilation error with error message :-
    Implementation missing for method “I1~METH2”
    if helpful please reward the points,
    Aruna

  • Tree interface concept for hierarchical data creation/modification

    I am designing an interface for hierarchical data creation and maintenance. The interface will have to provide all basic data modifications options:
    edit an existing node, add new child/parent/sibling, as well as removing, sorting, dragging and dropping nodes around. Flex tree control is fully capable of all these functions while coding is not going to be a simple task. Has anyone worked on something like this? Any conceptual ideas?
    Thanks

    WOW Odie! You're awesome !! It worked like a charm, I created a view as you suggested:
    CREATE OR REPLACE FORCE VIEW "VIEW_TASKS_PROJECTS_TREE" ("ID", "PARENT_ID", "NODE_NAME") AS
    SELECT to_char(id) as id
    , null as parent_id
    , project_name as node_name
    FROM eba_task_projects
    UNION ALL
    SELECT to_char(id)
    , to_char(project_id)
    , task_name
    FROM eba_task_tasks;
    And then I created a new tree with the defaults and customized the Tree query a bit (just added the links really):
    select case when connect_by_isleaf = 1 then 0
    when level = 1 then 1
    else -1
    end as status,
    level,
    "NODE_NAME" as title,
    null as icon,
    "ID" as value,
    null as tooltip,
    'f?p=&APP_ID.:22:&SESSION.::NO::P22_ID,P22_PREV_PAGE:' || "ID" || ',3' as link
    from "#OWNER#"."VIEW_TASKS_PROJECTS_TREE"
    start with "PARENT_ID" is null
    connect by prior "ID" = "PARENT_ID"
    order siblings by "NODE_NAME"
    Thanks man, you saved me a lot of time and headaches :)

  • Interfaces in webdynpro java

    Hi all,
    I have a doubt about the programming in webdynpro java interfaces . what is the main concept underlying in context of a particular view, why to use the follwing code for referring to context attribute
    IPrivate<viewname>.I<NodeName> node = wdContext.node<NodeName>();
    IPrivate<viewname>.I<NodeName>Element ele = node.create<NodeName>Element();
    ele.set<Nodeattribute>("xxxxx");
    node.addElement(ele);
    Is the context is a Interface ?
    please explain me the above code or any relavant documents for Interfaces implementation in webdynpro java
    Total no of interfaces in webdynpro java list.
    Thanks
    prasad

    Hi Prasad,
    Web Dynpro controller has a data storage area known as the context. This is a hierarchical repository within which all runtime data used by the controller is stored..Context is not an interface in the code you are trying to set some value to the context attribute by getting that particulat context node reference.
    Find the below links which explains you clearly about webdynpros and interface concept
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f0ba2c45-0518-2a10-73be-9b785e10aef1?QuickLink=index&overridelayout=true
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/a048387a-0901-0010-13ac-87f9eb649381?QuickLink=index&overridelayout=true
    Hope it helps.....
    Thanks,
    Rahul.
    Edited by: rahul.girmaji on Dec 12, 2011 6:45 PM

  • Need case studies and sample code for all concept of ABAP

    Hello,
           Can anybody provide me the case studies and sample code for learning different concepts in ABAP programming like: module pool, ALV, interactive reports, BDC, Smart Form etc.? As I want to do some practical application by which i can learn more.
    Thanks & Regards,
    Vikram Rawal

    In this link You can find Step by Step Scren Shot document :
    http://www.201interviewquestions.com/docs/User%20exits.ppt
    http://erpgenie.com/abaptips/component/option,com_docman/task,doc_details/gid,27/
    <b>
    Reprots</b>
    http://www.sapgenie.com/abap/reports.htm
    http://www.allsaplinks.com/material.html
    http://www.sapdevelopment.co.uk/reporting/reportinghome.htm
    http://www.sapfans.com/forums/viewtopic.php?t=58286
    http://www.sapfans.com/forums/viewtopic.php?t=76490
    http://www.sapfans.com/forums/viewtopic.php?t=20591
    http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.
    <b>Dictionary</b>
    http://sapabap.iespana.es/sapabap/manuales/learnabap/
    http://help.sap.com/saphelp_nw2004s/helpdata/en/43/41341147041806e10000000a1553f6/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eb6e446011d189700000e8322d00/content.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/cf/21ea31446011d189700000e8322d00/frameset.htm
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCDWBDIC/BCDWBDIC.pdf
    <b>ABAP objects</b>
    Please check this online document (starting page 1291).
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf
    Also check this links as well.
    http://help.sap.com/saphelp_nw2004s/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    http://www.sapgenie.com/abap/OO/
    http://www.futureobjects.de/content/intro_oo_e.html
    http://www.sap-img.com/abap/business-add-in-you-need-to-understand-abap-oo-interface-concept.htm
    /people/ravikumar.allampallam/blog/2005/02/11/abap-oo-in-action
    <b>
    SAPScripts</b>
    http://esnips.com/doc/1ff9f8e8-0a4c-42a7-8819-6e3ff9e7ab44/sapscripts.pdf
    http://esnips.com/doc/1e487f0c-8009-4ae1-9f9c-c07bd953dbfa/script-command.pdf
    http://esnips.com/doc/64d4eccb-e09b-48e1-9be9-e2818d73f074/faqss.pdf
    http://esnips.com/doc/cb7e39b4-3161-437f-bfc6-21e6a50e1b39/sscript.pdf
    http://esnips.com/doc/fced4d36-ba52-4df9-ab35-b3d194830bbf/symbols-in-scripts.pdf
    http://esnips.com/doc/b57e8989-ccf0-40d0-8992-8183be831030/sapscript-how-to-calculate-totals-and-subtotals.htm
    SAP SCRIPT FIELDS
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/d1/8033ea454211d189710000e8322d00/content.htm
    scripts easy material
    http://www.allsaplinks.com/sap_script_made_easy.html
    Check these step-by-step links
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/ccab6730-0501-0010-ee84-de050a6cc287
    https://sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/8fd773b3-0301-0010-eabe-82149bcc292e
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/3c5d9ae3-0501-0010-0090-bdfb2d458985
    <b>Smartforms material</b>
    http://www.sap-basis-abap.com/sapsf001.htm
    http://www.sap-press.com/downloads/h955_preview.pdf
    http://www.ossincorp.com/Black_Box/Black_Box_2.htm
    http://www.sap-img.com/smartforms/sap-smart-forms.htm
    http://www.sap-img.com/smartforms/smartform-tutorial.htm
    http://www.sapgenie.com/abap/smartforms.htm
    How to trace smartform
    http://help.sap.com/saphelp_47x200/helpdata/en/49/c3d8a4a05b11d5b6ef006094192fe3/frameset.htm
    http://www.help.sap.com/bp_presmartformsv1500/DOCU/OVIEW_EN.PDF
    http://www.sap-img.com/smartforms/smart-006.htm
    http://www.sap-img.com/smartforms/smartforms-faq-part-two.htm
    Re: Need FAQ's
    check most imp link
    http://www.sapbrain.com/ARTICLES/TECHNICAL/SMARTFORMS/smartforms.html
    step by step good ex link is....
    http://smoschid.tripod.com/How_to_do_things_in_SAP/How_To_Build_SMARTFORMS/How_To_Build_SMARTFORMS.html
    <b>
    BAPI</b>
    http://help.sap.com/saphelp_46c/helpdata/en/9b/417f07ee2211d1ad14080009b0fb56/frameset.htm
    http://searchsap.techtarget.com/originalContent/0,289142,sid21_gci948835,00.html
    Checkout !!
    http://searchsap.techtarget.com/originalContent/0,289142,sid21_gci948835,00.html
    http://techrepublic.com.com/5100-6329-1051160.html#
    http://www.sap-img.com/bapi.htm
    http://www.sap-img.com/abap/bapi-conventions.htm
    http://www.sappoint.com/abap/bapiintro.pdf
    http://www.sapgenie.com/abap/bapi/example.htm
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCMIDAPII/CABFAAPIINTRO.pdf
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/CABFABAPIREF/CABFABAPIPG.pdf
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCFESDE8/BCFESDE8.pdf
    <b>List of all BAPIs</b>
    http://www.planetsap.com/LIST_ALL_BAPIs.htm
    http://www.sappoint.com/abap/bapiintro.pdf
    http://www.sappoint.com/abap/bapiprg.pdf
    http://www.sappoint.com/abap/bapiactx.pdf
    http://www.sappoint.com/abap/bapilst.pdf
    http://www.sappoint.com/abap/bapiexer.pdf
    http://service.sap.com/ale
    http://service.sap.com/bapi
    http://www.planetsap.com/Bapi_main_page.htm
    http://www.topxml.com/sap/sap_idoc_xml.asp
    http://www.sapdevelopment.co.uk/
    http://www.sapdevelopment.co.uk/java/jco/bapi_jco.pdf
    <b>ALV programs.</b>
    http://www.geocities.com/mpioud/Abap_programs.html
    . How do I program double click in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=11601
    http://www.sapfans.com/forums/viewtopic.php?t=23010
    How can I use ALV for reports that are going to be run in background?
    http://www.sapfans.com/forums/viewtopic.php?t=83243
    http://www.sapfans.com/forums/viewtopic.php?t=19224
    <b>ALV</b>
    http://www.sapfans.com/forums/viewtopic.php?t=58286
    http://www.sapfans.com/forums/viewtopic.php?t=76490
    http://www.sapfans.com/forums/viewtopic.php?t=20591
    http://www.sapfans.com/forums/viewtopic.php?t=66305 - http://www.sapgenie.com/abap/reports.htm
    http://www.allsaplinks.com/material.html
    http://www.sapdevelopment.co.uk/reporting/reportinghome.htm
    <b>Top-of-page in ALV</b>
    selection-screen and top-of-page in ALV
    <b>ALV Group Heading</b>
    http://www.sap-img.com/fu037.htm
    <b>ALV</b>
    http://www.geocities.com/mpioud/Abap_programs.html
    <b>
    RFC Destination</b>
    Re: SM59
    <b>
    ALE/ IDOC</b>http://help.sap.com/saphelp_erp2004/helpdata/en/dc/6b835943d711d1893e0000e8323c4f/content.htm
    http://www.sapgenie.com/sapgenie/docs/ale_scenario_development_procedure.doc
    http://www.netweaverguru.com/EDI/HTML/IDocBook.htm
    http://www.sapgenie.com/sapedi/index.htm
    http://www.sappoint.com/abap/ale.pdf
    http://www.sappoint.com/abap/ale2.pdf
    http://www.sapgenie.com/sapedi/idoc_abap.htm
    http://www.allsaplinks.com/idoc_sample.html
    http://www.sappoint.com/abap.html
    http://www.netweaverguru.com/EDI/HTML/IDocBook.htm
    http://www.sapgenie.com/sapedi/index.htm
    http://www.allsaplinks.com/idoc_sample.html
    <b>Table Control</b>
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/table%20control%20in%20abap.pdf
    <b>
    ABAP transactions</b>
    http://www.easymarketplace.de/transactions-a-e.php?Area=4soi&name=volker&pw=vg&
    Regards,
    Priyanka.

  • Abstract Class & Interfaces

    Can anyone please tell me as to why we need both an abstract class & an interface? I was asked in an interview as to why we need 2 separate concepts when we can get the similar functionality of an interface by using an abstract class. I had just sited their differences like:
    1) An abstract class can have both abstract & normal methods & that we can specify different access specifiers for its class members.
    2) ABAP does not support Multiple inheritance but that we could simulate the same using interfaces concept in ABAP.
    But he wasnt satisfied with the answer. I guess he was expecting something from a practical point of view. I did try searching the old threads but there wasnt anything similar to this. Anyone please explain by citing a scenario as to why we would need 2 separate concepts & not just one .
    Thanks in advance

    Hi
    Abstract classes
    Abstract classes are normally used as an incomplete blueprint for concrete (that is, non-abstract) subclasses, for example to define a uniform interface.
    Classes with at least one abstract method are themselves abstract.
    Static methods and constructors cannot be abstract.
    You can specify the class of the instance to be created explicitly: CREATE OBJECT <RefToAbstractClass> TYPE <NonAbstractSubclassName>.
    Abstarct classes themselves can’t be instantiated ( althrough their subclasses can)
    Reference to abstract classes can refer to instance of subclass
    Abstract (instance) methods are difined in the class , but not implemented
    They must be redefined in subclasses
    CLASS LC1 DEFINAITION ABSTARCT
    PUBLIC SECTION
    METHODS ESTIMATE ABSTARCT IMPORTING…
    ENDCLASS.
    <b>Interfaces</b>
    Interfaces only describe the external point of contact of a class (protocols), they do not contain any implementation.
    Interfaces are usually defined by a user. The user describes in the interface which services (technical and semantic) it needs in order to carry out a task.
    The user never actually knows the providers of these services, but communicates with them through the interface.
    In this way the user is protected from actual implementations and can work in the same way with different classes/objects, as long as they provide the services required. This is known as polymorphism with interfaces.

  • Why interfaces?

    I have difficulties in understanding why would I use an interface if I wanted to communicate between two (or more) classes.
    Because the interface is by definition abstract, every class implementing the interface has to accept all of its methods (if not declaring itself abstract as well). I only mention this because I understand it, to get to what I don't:
    Why would I want to communicate between classes with an interface, if I can do it without? Each class only shares the name of a method in an interface, nothing more. (Is this so?)
    If I wanted to execute a series of commands (a method) from another class by calling a method implemented from an interface, how could I do this through an interface? It seems I cannot, while I thought this was the reason to implement interfaces in the first place.
    Please clear my scrambled thoughts.

    Hi bec!
    I have exactly the same problem understanding the
    interface concept. I still don't get it from
    DanPerkins' code example; if you remove the interface
    definition, and the implements bit out of each of the
    classes, the code still works. So what's the added
    value of the interface. Also, code to turn the tv on
    is not the same as to turn on the stereo, so there
    isn't any code reuse either. Confused.You use interfaces to keep your classes from having intimate knowledge of each other. Say you're writing code to operate a register/scanner at a grocery store. Everytime your store gets a new kind of item in inventory, you don't want to have to update your class to handle the new item.
    class Register {
      double scan( Banana b ) {
        return b.getPrice();
      double scan( Rice r ) {
        return r.getPrice();
      // etc., etc.
    }This approach means that Register is tied at the hip to every food item class in the store. Isn't it much nicer to write Register this way:
    interface BuyableItem {
      double getPrice();
    class Banana implements BuyableItem {
      double getPrice() {
        return this.getWeight() * this.getUnitPrice();
    class Rice implements BuyableItem {
      double getPrice() {
        return this.getCost();
    class Register {
      // Handle the item generically.
      //  This way if there's special logic to finding
      //  the price, like it's on special this week, or
      //  it's an item that gets priced by the pound,
      //  the Register class doesn't care.  That implementation
      //  is left to the BuyableItem.
      double scan( BuyableItem item ) {
        return item.getPrice();
    public static void main( String[] args ) {
      // Refer to each food by interface
      BuyableItem banana = new Banana();
      BuyableItem rice = new Rice();
      Register reg = new Register();
      double totalCost = 0;
      totalCost += reg.scan( banana );
      totalCost += reg.scan( rice );
      System.out.println( "Total cost is: " + totalCost );
    }Interfaces become important when you maintain your code for a while and suddenly discover that you have to add support for a new object.

  • Interface WD ABAP.

    Dear Experts.
    I am new with WD ABAP. In this moment I am reading the documentation "NET310 ABAP Web Dynpro".
    I never have understand the concept of Interface in Object-Oriented Programming (OOP).
    Please anyone can help me to understandad this concept?
    Regards

    Hi Carmen,
    it is a huge subject itself to explain  and i am afraid that it is not a right forum to discus.
    To understand interface, you need to understand what is Polymorphism.
    Polymorphism  in a nutshell is that the objects receives same message definition but behaves in a different manner.
    example calculate_fuel method in different classes has the same importing parameter and returning parameters but the calculations could be implemented differently in different classes.
    Interface has only definitions, you need to implement them. in this way interface concept enables to achieve Polymorphism.
    ABAP Objects does not support multiple inheritance. Therefore you can only have a single super-class. However a class can implement multiple interfaces to have kind of multiple inheritance.

  • Why interfaces why not abstract classes?

    why they are using interfaces concept in JDBC or struts2.0 why not abstract classes?
    thanks in advance.

    user5287726 wrote:
    jverd wrote:
    user5287726 wrote:
    Interfaces are more flexible. For certain definitions of flexible, yes, but not for others.
    A Java class can only inherit one class, but it can implement multiple interfaces.Which has absolutely nothing to do with why JDBC declares interfaces rather than abstract classes.How does your post even attempt to answer the OP's question?OP asked: "why they are using interfaces concept in JDBC or struts2.0 why not abstract classes?" I'm pointing out that your post does not address the question asked. And of course your answer is wrong anyway.
    As for addressing the OP's question, I did that in my first response.

  • Object oriented concepts

    Hi Gurus,
    I want to know thw difference between objectoriented program and abap general programme?
    thanks in advance

    Hi Rama Krishna ,
    Object Orientation
    A programming technique in which solutions reflect real world objects
    What are objects ?
    An object is an instantiation of a class. E.g. If “Animal” is a class, A cat
    can be an object of that class .
    With respect to code, Object refers to a set of services ( methods /
    attributes ) and can contain data
    What are classes ?
    A class defines the properties of an object. A class can be instantiated
    as many number of times
    Advantages of Object Orientated approach
    Easier to understand when the system is complex
    Easy to make changes
    Encapsulation - Can restrict the visibility of the data ( Restrict the access to the data )
    Polymorphism - Identically named methods behave differently in different classes
    Inheritance - You can use an existing class to define a new class
    Polymorphism and inheritance lead to code reuse
    Classes in abap
    Classes in ABAP are either local or global
    Global classes are declared in class builder (SE24 )
    Local classes are declared within programs
    Components of a class
    Attributes : Internal data fields of class
    Attributes can be either instance attributes – specific to each instance of the class ( object ) or static attributes which are common to all instances
    Methods :
    Subroutines / procedures in a class that define the behavior of the object. Methods can also be instance methods or static methods
    Encapsulation in ABAP
    Encapsulation is obtained through the restriction in visibility of attributes / methods attained through the definition of Public, Private and Protected section of a class
    Public Section
    All of the components declared in the public section are accessible to all users of the class, and to the methods of the class and any classes that inherit from it. The public components of the class form the interface between the class and its users.
    Protected Section
    All of the components declared in the protected section are accessible to all methods of the class and of classes that inherit from it.
    Private Section
    Components that you declare in the private section are only visible in the methods of the same class.
    Inheritance in ABAP
    Inheritance allows you to derive a class based on an already existing class.
    CLASS <subclass> DEFINITION INHERITING FROM <superclass>.
    ENDCLASS.
    CLASS <subclass> IMPLEMENTATION.
    ENDCLASS.
    All attributes / methods of super class become the property of the subclass too. Only public and protected attributes / methods are visible in the subclass
    Polymorphism in ABAP
    When methods with same name perform differently under different
    circumstances we call it polymorphism.
    Methods redefined in a subclass is an example for Polymorphism
    Interfaces
    Interfaces are used to define the model of a class.
    They also like classes can be either local or global.
    Global interfaces are defined through SE24 and local interfaces are defined in program.
    Please check this online document (starting page 1291).
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf
    Also check this links as well.
    http://help.sap.com/saphelp_nw2004s/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    http://www.sapgenie.com/abap/OO/
    http://www.futureobjects.de/content/intro_oo_e.html
    http://www.sap-img.com/abap/business-add-in-you-need-to-understand-abap-oo-interface-concept.htm
    /people/ravikumar.allampallam/blog/2005/02/11/abap-oo-in-action
    check the below links lot of info and examples r there
    http://www.sapgenie.com/abap/OO/index.htm
    http://www.geocities.com/victorav15/sapr3/abap_ood.html
    http://www.brabandt.de/html/abap_oo.html
    Check this cool weblog:
    /people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql
    /people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql
    Hope this resolves your query.
    Reward all the helpful answers.
    Thanks & Regards
    Bhaskar rao.M

  • Table interface

    Can anyone explain table interface concept with examples
    sridhar

    Take a look in the below link
    http://help.sap.com/saphelp_nw04/helpdata/en/6e/8fc2d7dd0d11d2bdba080009b4534c/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/a2/06a83a4bd5a27ae10000000a11402f/content.htm

Maybe you are looking for

  • Need help with calculator project for an assignment...

    Hi all, I please need help with my calculator project that I have to do for an assignment. Here is the project's specifications that I need to do" """Create a console calculator applicaion that: * Takes one command line argument: your name and surnam

  • PURCHASE ORDER CREATION USING ALE ( BAPI )...

    HI,       I DESPERATELY NEED SOME ADVISE IN CREATING A PURCHASE ORDER USING ALE....I AM VERY NEW TO ALE SO CAN ANYONE EXPLAIN IN STEPS WHAT TO BE DONE IN DETAIL....PLS HELP ME OUT IN THIS REGARD....I WILL GET SOME DATA AS INBOUND IDOCS AND I NEED TO

  • How can a specific check box selection initiate addional questions to display.

    I want additional questions to display if a certain checkbox, let's say a checkbox next to "Yes" response, is selected. Different questions, or no questions might display if "No" checkbox was selected.  Is this possible? If so, how is it done? Thanks

  • Help making a paint program in Flash

    So, all this basically does so far is create a few colored squares on the stage and let me draw in black. I'm trying to get it to let me trace() some incremental value onRelease of the different colors but I can't seem to get it to work. Can someone

  • Adding custom code in generated HTML pages?

    Hi We have a customer running Weblogic Portal 8.1 sp3 ia64. They need to add some custom html code like <META ... tags within the <HEAD. How to do that? Best regards Anders Rothman