What is a "Class Interface"?

I know what a class is; I know what an interface is. Today I was looking at somebodies code, and in SE24 they have defined a "Class Interface", NOT a class or an interface.
Does anybody know:
1) What is the difference between this and an ordinary interface?
2) How do you create it in SE24 (When you create a new entity here it gives the option for "Class" or "Interface", but not "Class Interface"?

What you may be seeing is the description next to the actual class name in SE24, where it says "Class Interface".  Is this right?  If so,  just know that this is a class and the description here is a little misleading.  There are only classes and interfaces in regard to obect types, there is not a third.
http://help.sap.com/saphelp_erp2005/helpdata/en/ee/e440ac70a111d1b44c0000e8a52bed/frameset.htm
Regards,
Rich Heilman

Similar Messages

  • What are the classes and interface in JDBC

    Please anybody tell me
    What are the Classes in JDBC?
    and
    What are the Interfaces in JDBC?
    Will you please show the classes in one table and interfaces in one table. Plesae
    regards
    pooja.

    Hi jeyan,
    Very more thanks. I am searching lot of time in net to exactly get the classes and interface in jdbc. Now you have given helpful link.
    thank you.
    regards
    pooja

  • HT1925 My ipod is not showing up when I have itunes up. I was told to remove itunes and reinstall however. I receive a message with unable to uninstall the Itunes. It states "could not open key HKEY_LOCAL_MACHINE\SOFTWARE\CLASSES\INTERFACE\(915DA835-02FE-

    can someone please advise on what I should do? unable to uninstall the Itunes. It states "could not open key HKEY_LOCAL_MACHINE\SOFTWARE\CLASSES\INTERFACE\(915DA835-02FE-4953-92FA-624BDF5D 85AB) VEIFY THAT YOU HAVE SUFFICIENT ACCESS TO THAT KEY, OR CONTACT YOUR SUPPORT PERSONNEL,  Which i did . I contacted the apple support and they could not help. has anyone gotten this error? Did some research some results show that this has occurred during updates on the itunes but has not seen how to successfully uninstall without getting this error. I attempted to use the control panel and uninstall but it provides me with the same error all the time. I NEED SOME Answers on this issue. Can you please help?!

    Perhaps try the fixit from the following Microsoft web page. (Try the "problems uninstalling" option.)
    Fix problems with programs that can't be installed or uninstalled

  • Class, interface, or enum expected?

    Ok I keep getting that error. Here is my java file that it is in.
    package server.main.project12.skills;
    import java.io.*;
    import server.main.project12.*;
    public class fireMaking {
    public int xpgained = 1;//Change this and the fire xp will be times by that, so 40 time 1 = 40, 40
    times 100 = 4000.
        public void WalkTo(int x, int y) { 
            newWalkCmdSteps = (Math.abs((x+y)));
            if(newWalkCmdSteps % 1 != 0)
                newWalkCmdSteps /= 1;
            if(++newWalkCmdSteps > walkingQueueSize) {
                println("Warning: WalkTo("+packetType+") command contains too many steps
    ("+newWalkCmdSteps+").");
                newWalkCmdSteps = 0;
            int firstStepX = absX;
            int tmpFSX = firstStepX;
            firstStepX -= mapRegionX*8;
            for(i = 1; i < newWalkCmdSteps; i++) {
                newWalkCmdX[i] = x;
                newWalkCmdY[i] = y;
                tmpNWCX[i] = newWalkCmdX;
    tmpNWCY[i] = newWalkCmdY[i];
    newWalkCmdX[0] = newWalkCmdY[0] = tmpNWCX[0] = tmpNWCY[0] = 0;
    int firstStepY = absY;
    int tmpFSY = firstStepY;
    firstStepY -= mapRegionY*8;
    newWalkCmdIsRunning = ((inStream.readSignedByteC() == 1) && playerEnergy > 0);
    for(i = 0; i < newWalkCmdSteps; i++) {
    newWalkCmdX[i] += firstStepX;
    newWalkCmdY[i] += firstStepY;
    public int firetimer = 0;
    public int firetimers = 0;
    public int firetimers1 = 0;
    public int firetimers2 = 0;
    public int firetimers3 = 0;
    public int firetimers4 = 0;
    public int firetimers5 = 0;
    public int firetimers6 = 0;
    public int firetimers7 = 0;
    public int firetimers8 = 0;
    public int firetimers9 = 0;
    public int firetimers10 = 0;
    public int firetimers11 = 0;
    public int firetimers12 = 0;
    public int firetimers13 = 0;
    public int firetimers14 = 0;
    public int firetimers15 = 0;
    public int firetimers16 = 0;
    public int firetimers17 = 0;
    public int firetimers18 = 0;
    public int firetimers19 = 0;
    public int previousX = 0;
    public int previousY = 0;
    public int previousX1 = 0;
    public int previousY1 = 0;
    public int previousX2 = 0;
    public int previousY2 = 0;
    public int previousX3 = 0;
    public int previousY3 = 0;
    public int previousX4 = 0;
    public int previousY4 = 0;
    public int previousX5 = 0;
    public int previousY5 = 0;
    public int previousX6 = 0;
    public int previousY6 = 0;
    public int previousX7 = 0;
    public int previousY7 = 0;
    public int previousX8 = 0;
    public int previousY8 = 0;
    public int previousX9 = 0;
    public int previousY9 = 0;
    public int previousX10 = 0;
    public int previousY10 = 0;
    public int previousX11 = 0;
    public int previousY11 = 0;
    public int previousX12 = 0;
    public int previousY12 = 0;
    public int previousX13 = 0;
    public int previousY13 = 0;
    public int previousX14 = 0;
    public int previousY14 = 0;
    public int previousX15 = 0;
    public int previousY15 = 0;
    public int previousX16 = 0;
    public int previousY16 = 0;
    public int previousX17 = 0;
    public int previousY17 = 0;
    public int previousX18 = 0;
    public int previousY18 = 0;
    public int previousX19 = 0;
    public int previousY19 = 0;
    public int logID = 0;
    public boolean process() {
    //FIRE MAKING TIMERS
    if(firetimer > 0)
    firetimer -= 1;
    if(firetimers > 0)
    firetimers -= 1;
    if(firetimers1 > 0)
    firetimers1 -= 1;
    if(firetimers3 > 0)
    firetimers3 -= 1;
    if(firetimers2 > 0)
    firetimers2 -= 1;
    if(firetimers4 > 0)
    firetimers4 -= 1;
    if(firetimers5 > 0)
    firetimers5 -= 1;
    if(firetimers6 > 0)
    firetimers6 -= 1;
    if(firetimers7 > 0)
    firetimers7 -= 1;
    if(firetimers8 > 0)
    firetimers8 -= 1;
    if(firetimers9 > 0)
    firetimers9 -= 1;
    if(firetimers10 > 0)
    firetimers10 -= 1;
    if(firetimers11 > 0)
    firetimers11 -= 1;
    if(firetimers13 > 0)
    firetimers13 -= 1;
    if(firetimers12 > 0)
    firetimers12 -= 1;
    if(firetimers14 > 0)
    firetimers14 -= 1;
    if(firetimers15 > 0)
    firetimers15 -= 1;
    if(firetimers16 > 0)
    firetimers16 -= 1;
    if(firetimers17 > 0)
    firetimers17 -= 1;
    if(firetimers18 > 0)
    firetimers18 -= 1;
    if(firetimers19 > 0)
    firetimers19 -= 1;
    if(firetimers == 1)
    ItemHandler.addItem(592, previousX, previousY, 1, playerId, false);
    ReplaceObject2(previousX, previousY, 6951, 0, 10);
    previousX = 0;
    previousY = 0;
    if(firetimers1 == 1)
    ItemHandler.addItem(592, previousX1, previousY1, 1, playerId, false);
    ReplaceObject2(previousX1, previousY1, 6951, 0, 10);
    previousX1 = 0;
    previousY1 = 0;
    if(firetimers2 == 1)
    ItemHandler.addItem(592, previousX2, previousY1, 1, playerId, false);
    ReplaceObject2(previousX2, previousY2, 6951, 0, 10);
    previousX2 = 0;
    previousY2 = 0;
    if(firetimers3 == 1)
    ItemHandler.addItem(592, previousX3, previousY3, 1, playerId, false);
    ReplaceObject2(previousX3, previousY3, 6951, 0, 10);
    previousX3 = 0;
    previousY3 = 0;
    if(firetimers4 == 1)
    ItemHandler.addItem(592, previousX4, previousY4, 1, playerId, false);
    ReplaceObject2(previousX4, previousY4, 6951, 0, 10);
    previousX4 = 0;
    previousY4 = 0;
    if(firetimers5 == 1)
    ItemHandler.addItem(592, previousX5, previousY5, 1, playerId, false);
    ReplaceObject2(previousX5, previousY5, 6951, 0, 10);
    previousX5 = 0;
    previousY5 = 0;
    if(firetimers9 == 1)
    ItemHandler.addItem(592, previousX9, previousY9, 1, playerId, false);
    ReplaceObject2(previousX9, previousY9, 6951, 0, 10);
    previousX9 = 0;
    previousY9 = 0;
    if(firetimers8 == 1)
    ItemHandler.addItem(592, previousX8, previousY8, 1, playerId, false);
    ReplaceObject2(previousX8, previousY8, 6951, 0, 10);
    previousX8 = 0;
    previousY8 = 0;
    if(firetimers7 == 1)
    ItemHandler.addItem(592, previousX7, previousY7, 1, playerId, false);
    ReplaceObject2(previousX7, previousY7, 6951, 0, 10);
    previousX7 = 0;
    previousY7 = 0;
    if(firetimers6 == 1)
    ItemHandler.addItem(592, previousX6, previousY6, 1, playerId, false);
    ReplaceObject2(previousX6, previousY6, 6951, 0, 10);
    previousX6 = 0;
    previousY6 = 0;
    if(firetimers10== 1)
    ItemHandler.addItem(592, previousX10, previousY10, 1, playerId, false);
    ReplaceObject2(previousX10, previousY10, 6951, 0, 10);
    previousX10 = 0;
    previousY10 = 0;
    if(firetimers11 == 1)
    ItemHandler.addItem(592, previousX11, previousY11, 1, playerId, false);
    ReplaceObject2(previousX11, previousY11, 6951, 0, 10);
    previousX11 = 0;
    previousY11 = 0;
    if(firetimers12 == 1)
    ItemHandler.addItem(592, previousX12, previousY12, 1, playerId, false);
    ReplaceObject2(previousX12, previousY12, 6951, 0, 10);
    previousX12 = 0;
    previousY12 = 0;
    if(firetimers13 == 1)
    ItemHandler.addItem(592, previousX13, previousY13, 1, playerId, false);
    ReplaceObject2(previousX13, previousY13, 6951, 0, 10);
    previousX13 = 0;
    previousY13 = 0;
    if(firetimers14 == 1)
    ItemHandler.addItem(592, previousX14, previousY14, 1, playerId, false);
    ReplaceObject2(previousX14, previousY14, 6951, 0, 10);
    previousX14 = 0;
    previousY14 = 0;
    if(firetimers15 == 1)
    ItemHandler.addItem(592, previousX15, previousY15, 1, playerId, false);
    ReplaceObject2(previousX15, previousY15, 6951, 0, 10);
    previousX15 = 0;
    previousY15 = 0;
    if(firetimers19 == 1)
    ItemHandler.addItem(592, previousX19, previousY19, 1, playerId, false);
    ReplaceObject2(previousX19, previousY19, 6951, 0, 10);
    previousX19 = 0;
    previousY19 = 0;
    if(firetimers18 == 1)
    ItemHandler.addItem(592, previousX18, previousY18, 1, playerId, false);
    ReplaceObject2(previousX18, previousY18, 6951, 0, 10);
    previousX18 = 0;
    previousY18 = 0;
    if(firetimers17 == 1)
    ItemHandler.addItem(592, previousX17, previousY17, 1, playerId, false);
    ReplaceObject2(previousX17, previousY17, 6951, 0, 10);
    previousX17 = 0;
    previousY17 = 0;
    if(firetimers16 == 1)
    ItemHandler.addItem(592, previousX16, previousY16, 1, playerId, false);
    ReplaceObject2(previousX16, previousY16, 6951, 0, 10);
    previousX16 = 0;
    previousY16 = 0;
    if(firetimer == 1)
    if(logID == 1)
    addSkillXP((40*xpgained), 11);
    removeGroundItem(absX, absY, 1511);
    logID = 0;
    if(logID == 2)
    addSkillXP((60*xpgained), 11);
    removeGroundItem(absX, absY, 1521);
    logID = 0;
    if(logID == 3)
    addSkillXP((90*xpgained), 11);
    removeGroundItem(absX, absY, 1519);
    logID = 0;
    if(logID == 4)
    addSkillXP((135*xpgained), 11);
    removeGroundItem(absX, absY, 1517);
    logID = 0;
    if(logID == 5)
    addSkillXP((202*xpgained), 11);
    removeGroundItem(absX, absY, 1515);
    logID = 0;
    if(logID == 6)
    addSkillXP((303*xpgained), 11);
    removeGroundItem(absX, absY, 1513);
    logID = 0;
    WalkTo(-1, 0);
    sendMessage("The fire catches, and the logs begin to burn.");
    Object(absX, absY, 2732, 0, 10);
    firetimer = 0;
    updateRequired = true;
    appearanceUpdateRequired = true;
    if(previousX == 0 && previousY == 0)
    previousX = absX;
    previousY = absY;
    firetimers = 60; //DO NOT CHANGE THIS
    viewTo(previousX, previousY);
    else
    if(previousX1 == 0 && previousY1 == 0)
    previousX1 = absX;
    previousY1 = absY;
    firetimers1 = 60;
    viewTo(previousX1, previousY1);
    else
    if(previousX2 == 0 && previousY2 == 0)
    previousX2 = absX;
    previousY2 = absY;
    firetimers2 = 60;
    viewTo(previousX2, previousY2);
    else
    if(previousX3 == 0 && previousY3 == 0)
    previousX3 = absX;
    previousY3 = absY;
    firetimers3 = 60;
    viewTo(previousX3, previousY3);
    else
    if(previousX4 == 0 && previousY4 == 0)
    previousX4 = absX;
    previousY4 = absY;
    firetimers4 = 60;
    viewTo(previousX4, previousY4);
    else
    if(previousX5 == 0 && previousY5 == 0)
    previousX5 = absX;
    previousY5 = absY;
    firetimers5 = 60;
    viewTo(previousX5, previousY5);
    else
    if(previousX6 == 0 && previousY6 == 0)
    previousX6 = absX;
    previousY6 = absY;
    firetimers6 = 60;
    viewTo(previousX6, previousY6);
    else
    if(previousX7 == 0 && previousY7 == 0)
    previousX7 = absX;
    previousY7 = absY;
    firetimers7 = 60;
    viewTo(previousX7, previousY7);
    else
    if(previousX8 == 0 && previousY8 == 0)
    previousX8 = absX;
    previousY8 = absY;
    firetimers8 = 60;
    viewTo(previousX8, previousY8);
    else
    if(previousX9 == 0 && previousY9 == 0)
    previousX9 = absX;
    previousY9 = absY;
    firetimers9 = 60;
    viewTo(previousX9, previousY9);
    else
    if(previousX10 == 0 && previousY10 == 0)
    previousX10 = absX;
    previousY10 = absY;
    firetimers10 = 60;
    viewTo(previousX10, previousY10);
    else
    if(previousX11 == 0 && previousY11 == 0)
    previousX11 = absX;
    previousY11 = absY;
    firetimers11 = 60;
    viewTo(previousX11, previousY11);
    else
    if(previousX12 == 0 && previousY12 == 0)
    previousX12 = absX;
    previousY12 = absY;
    firetimers12 = 60;
    viewTo(previousX12, previousY12);
    else
    if(previousX13 == 0 && previousY13 == 0)
    previousX13 = absX;
    previousY13 = absY;
    firetimers13 = 60;
    viewTo(previousX13, previousY13);
    else
    if(previousX14 == 0 && previousY14 == 0)
    previousX14 = absX;
    previousY14 = absY;
    firetimers14 = 60;
    viewTo(previousX14, previousY14);
    else
    if(previousX15 == 0 && previousY15 == 0)
    previousX15 = absX;
    previousY15 = absY;
    firetimers15 = 60;
    viewTo(previousX15, previousY15);
    else
    if(previousX16 == 0 && previousY16 == 0)
    previousX16 = absX;
    previousY16 = absY;
    firetimers16 = 60;
    viewTo(previousX16, previousY16);
    else
    if(previousX17 == 0 && previousY17 == 0)
    previousX17 = absX;
    previousY17 = absY;
    firetimers17 = 60;
    viewTo(previousX17, previousY17);
    else
    if(previousX18 == 0 && previousY18 == 0)
    previousX18 = absX;
    previousY18 = absY;
    firetimers18 = 60;
    viewTo(previousX18, previousY18);
    else
    if(previousX19 == 0 && previousY19 == 0)
    previousX19 = absX;
    previousY19 = absY;
    firetimers19 = 60;
    viewTo(previousX19, previousY19);
    }And this is what my compiler is showing.C:\Users\Matthew\Documents\server.main.project12>javac *.java
    Note: stream.java uses or overrides a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    C:\Users\Matthew\Documents\server.main.project12>javac ./skills/*.java
    .\skills\firemaking.java:594: class, interface, or enum expected
    ^
    1 error
    C:\Users\Matthew\Documents\server.main.project12>pause
    Press any key to continue . . .I really need help with this.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    This error is often caused by improper matching of braces { }.
    Solution: Check the matching opening and closing braces.
    Worse, the error could be totally invisible! Often, it is the first thing in the file, before package or import declarations
    In that situation, it could be caused by a code edited / formatted using a text editor not designed for programming such as Word, which introduces invisible characters in the code.
    Solution : In that case, cut and paste the code in a true code editor as Eclipse or NotePad which withdrawing the offending characters.
    This error occurs most often in the console (command line), almost never in an IDE.

  • Class, interface, or emun expected.

    When I compile to code I get 60 "class, interface, or emun expected errors. I know that this error usual means that there is a bracket out of place or missing. I went through and add line comments that link the opening and closing brackets together. Can anyone take a look and let me know what I am missing. Thanks.
    {code}
    // Inventory4.java
    // Program will track total inventory items in stock.
    import java.io.*;
    import javax.swing.JFrame;
    public class Inventory4
    {//1
    public class Item
    {//2
    private double unitPrice;
    private double quantityStock;
    private double inventoryValue;
    private double totalInventory;
    private int itemNumber;
    private String itemName;
    /** Create a new instance of Item Name */
    public Item(double UnitPrice,double QuantityStock,int      ItemNumber,String ItemName)
    {//3
    itemName = ItemName;
    itemNumber = itemNumber;
    unitPrice = UnitPrice;
    quantityStock = QuantityStock;
    }//3
    public void setItemName(String ItemName)
    {//4
    itemName = ItemName;
    }//4
    public void setItemNumber(int ItemNumber)
    {//5
    itemNumber = ItemNumber;
    }//5
    public void setUnitPrice(String InventoryHardware)
    {//6
    inventoryHardware=InventoryHardware;
    }//6
    public void setUnitPrice(double UnitPrice)
    {//7
    unitPrice = UnitPrice;
    }//7
    public void setQuantityStock(double QuantityStock)
    {//8
    quantityStock = QuantityStock;
    }//8
    public String getItemName()
    {//9
    return itemName;
    }//9
    public int getItemNumber()
    {//10
    return itemNumber;
    }//10
                        public String getInvetoryHardware()
    {//11
                        return inventoryHardware;
    }//11
    public double getUnitPrice()
    {//12
    return unitPrice;
    }//12
    public double getQuantityStock()
    {//13
    return quantityStock;
    }//13
    public String getInventoryHardware()
    {//14
    return inventoryHardware;
    }//14
    public double computeinventoryValue()
    {//15
    return quantityStock * unitPrice;
    }//15
    public double computetotalInventory()
    {//16
    return totalInventory = totalInventory + inventoryValue;
    }//16
    public String toString()
    {//17
    return (itemName);
    }//17
    }//2
    }//1
    // SubItem.java
    // Sub class to main program
    public class SubItem extends Item
    {//18
    private String inventoryHardware;
    private double restockingFee = .05;
    public SubItem(double UnitPrice,double QuantityStock,int InventoryWriteoffs,int
    ItemNumber,String ItemName)
    {//19
    setUnitPrice(UnitPrice);
    setQuantityStock(QuantityStock);
    setItemNumber(ItemNumber);
    setItemName(ItemName);
    inventoryWriteoffs = InventoryWriteoffs;
    }//19
    public void setInventoryHardware(String InventoryHardware)
    {//20
    inventoryHardware = InventoryHardware;
    }//20
    public int getInventoryHardware()
    {//21
    return inventoryWriteoffs;
    }//21
    public double computeRestockingFee()
    {//22
    return ((getUnitPrice() * getQuantityStock()) * restockingFee);
    }//22
    }//18
    private static BufferedReader stdin = new BufferedReader( new InputStreamReader(      System.in ) );
    private static int totalCount = 5;
    public Inventory4()
    {//23
    double unitPrice; // Unit price of each item
    double quantityStock; // Number of items in stock
    double inventoryValue; // Place holder for calculated inventory value
    double totalInventory; // Place holder for calculated total inventory value
    int itemNumber; // Item Number
    String itemName = ""; // Name of each item
    }//23
    public static void main(String[] args)throws IOException
    {//24
    SubItem myItem[];
    myItem = new SubItem[5];
    myItem[0] = new SubItem(10.35,20,4,1,"Traxx");
    myItem[1] = new SubItem(176.34,10,5,2,"Panels");
    myItem[2] = new SubItem(85.34,4,4,3,"Surfaces");
    myItem[3] = new SubItem(1.95,56,6,4,"Brackets");
    myItem[4] = new SubItem(82.34,8,1,5,"Overheads");
    printArray(myItem);
    myItem = sortArray(myItem);
    System.out.println(" Inventory List Sorted by Items \n\n");
    printArray(myItem);
    ItemButton itemButton = new ItemButton(myItem,totalCount); // Make ItemButton
    itemButton.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
    itemButton.setSize( 350,390 ); // Window size
    itemButton.setVisible( true ); // display window
    } //24 End Main Method
    private static SubItem[] printArray(SubItem[] myItem)
    {//25
    double totalInventory = 0;
    double restockingFee = 0;
    for (int i = 0; i<5;++i)
    {//26
    System.out.println("\n The Item Number is " + i + myItem.getItemNumber() );
    System.out.println("\n Item Name is " + myItem.getItemName() );
    System.out.println("\n Quantity in Stock is " + myItem.getQuantityStock() );
    System.out.println("\n Inventory Write-off is " +      myItem.getInventoryWriteoffs() );
    System.out.println("\n Inventory Value is $" + myItem.computeinventoryValue               ());
    totalInventory = totalInventory + myItem.computeinventoryValue();
    restockingFee = totalInventory + myItem.computeRestockingFee();
    } //26 End For Loop
    System.out.println("\n Total Value of all inventory is " + totalInventory);
    System.out.println("\n Total Value of all inventory with restock fee $" +      restockingFee);
    return myItem;
    }//25
    private static SubItem[] sortArray(SubItem[] myItem)
    {//27
    SubItem temp = new SubItem();
    int i, j;
    int array_size = 5;
    for (i = (array_size - 1); i >= 0; i--)
    {//28
    for (j = 1; j <= i; j++)
    {//29
    if (myItem[j-1].getItemName().compareTo(myItem[j].getItemName()) > 1)
    {//30
    temp = myItem[j-1];
    myItem[j-1] = myItem[j];
    myItem[j] = temp;
    } //30 End if
    } //29 End inner for loop
    } //28 End outer for loop
    return myItem;
    } //27 End Method
    // ItemButton.java
    // This will create GUI buttons.
    // Display the Items.
    import java.awt.FlowLayout;
    import java.awt.event.ActionListener;
    import java.awt.event.ActionEvent;
    import javax.swing.JFrame;
    import javax.swing.JButton;
    import javax.swing.JLabel;
    import javax.swing.JTextField;
    import javax.swing.Icon;
    import javax.swing.ImageIcon;
    import javax.swing.JOptionPane;
    import javax.swing.SwingConstants;
    public class ItemButton extends JFrame
    {//31
    private JButton nextJButton; // text button
    private JButton prevJButton; // icon button
    private JLabel lblItemName; // text field with set size
    private JTextField txtItemName; // text field constructed with text
    private JTextField textField3; // text field with text and size
    private JLabel lblItemNumber; // text field with set size
    private JTextField txtItemNumber; // text field constructed with text
    private JLabel lblUnitPrice; // text field with set size
    private JTextField txtUnitPrice; // text field constructed with text
    private JLabel lblQuantityStock; // text field with set size
    private JTextField txtQuantityStock; // text field constructed with text
    private JLabel lblInventoryWriteoffs; // text field with set size
    private JTextField txtInventoryWriteoffs; // text field constructed with text
    private JLabel lblcomputeRestockingFee; // text field with set size
    private JTextField txtcomputeRestockingFee; // text field constructed with text
    private JLabel lblcomputeinventoryValue; // text field with set size
    private JTextField txtcomputeinventoryValue; // text field constructed with text
    private JLabel lblcomputetotalInventory; // text field with set size
    private JTextField txtcomputetotalInventory; // text field constructed with text
    SubItem[] arraySubItem;
    private int currentArrayCounter;
    private int arrayCount;
    public ItemButton(SubItem[] myItem, int totalArrayCount)
    {//32
    super ( "Inventory" );
    arraySubItem = myItem;
    arrayCount = totalArrayCount;
    currentArrayCounter = 0;
    setLayout( new FlowLayout() ); // set frame layout
    Icon iconNext = new ImageIcon( getClass().getResource( "" ) );
    Icon iconPrev = new ImageIcon( getClass().getResource( "" ) );
    lblItemName = new JLabel( "Item Name ");
    add( lblItemName ); // textField3 to JFrame
    txtItemName = new JTextField( "", 15 );
    add( txtItemName ); // add textField3 to JFrame
    lblItemNumber = new JLabel( "Item Number ");
    add( lblItemNumber ); // textField3 to JFrame
    txtItemNumber = new JTextField( "", 15 );
    add( txtItemNumber ); // add textField3 to JFrame
    lblUnitPrice = new JLabel( "Unit Price ");
    add( lblUnitPrice ); // textField3 to JFrame
    txtUnitPrice = new JTextField( "", 15 );
    add( txtUnitPrice ); // add textField3 to JFrame
    lblQuantityStock = new JLabel( "Quantity Stock " );
    add( lblQuantityStock ); // textField3 to JFrame
    txtQuantityStock = new JTextField( "", 15 );
    add( txtQuantityStock ); // add textField3 to JFrame
    lblInventoryHardware = new JLabel( "Inventory Hardware " );
    add( lblInventoryHardware ); // textField3 to JFrame
              txtInventoryHardware = new JTextField( "", 15 );
    add( txtInventoryHardware ); // add textField3 to JFrame
    lblcomputeRestockingFee = new JLabel( "Restocking Fee ");
    add( lblcomputeRestockingFee ); // textField3 to JFrame
    txtcomputeRestockingFee = new JTextField( "", 15 );
    add( txtcomputeRestockingFee ); // add textField3 to JFrame
    lblcomputeinventoryValue = new JLabel( "Inventory Value " );
    add( lblcomputeinventoryValue ); // textField3 to JFrame
    txtcomputeinventoryValue = new JTextField( "", 15 );
    add( txtcomputeinventoryValue ); // add textField3 to JFrame
    lblcomputetotalInventory = new JLabel( "Total Inventory ");
    add( lblcomputetotalInventory ); // textField3 to JFrame
    txtcomputetotalInventory = new JTextField( "", 15 );
    add( txtcomputetotalInventory ); // add textField3 to JFrame
                   nextJButton = new JButton( "Next" ); // button with Next
                   prevJButton = new JButton( "Previous"); // button with Prev
                   add(prevJButton);
                   add(nextJButton); // add plainJButton to JFrame
                   ButtonHandler handler = new ButtonHandler();
    nextJButton.addActionListener( handler );
    prevJButton.addActionListener( handler );
    setTextFields();
    } //32 End ButtonFrame constructor
    private class ButtonHandler implements ActionListener
    {//33
    public void actionPerformed( ActionEvent event )
    {//34
    if (event.getActionCommand()== "prevJButton")
    {//35
    currentArrayCounter++;
    }//35
    else
    {//36
    currentArrayCounter++;
    }//36
    setTextFields();
    } //34 End Method ActionPerformed
    } //33 End Private inner class ButtonHandler
    private void setTextFields()
    {//37
    if (currentArrayCounter == arrayCount)
    {//38
    currentArrayCounter = 0;
    }//38
    if (currentArrayCounter < 0)
    {//39
    currentArrayCounter = arrayCount;
    }//39
    txtItemName.setText(arraySubItem[currentArrayCounter].getItemName());
    txtItemNumber.setText(arraySubItem[currentArrayCounter].getItemNumber()      +"");
    txtUnitPrice.setText(arraySubItem[currentArrayCounter].getUnitPrice()+"");
    txtQuantityStock.setText(arraySubItem[currentArrayCounter].getQuantityStock      ()+"");
    txtInventoryWriteoffs.setText(arraySubItem      [currentArrayCounter].getInventoryWriteoffs()+"");
    txtcomputeRestockingFee.setText(arraySubItem      [currentArrayCounter].computeRestockingFee()+"");
    txtcomputeinventoryValue.setText(arraySubItem     [currentArrayCounter].computeinventoryValue()+"");
    txtcomputetotalInventory.setText(arraySubItem      [currentArrayCounter].computetotalInventory()+"");
    }//37
    } //31 End class ItemButton
    {code}

    I have eliminated most of the problems, but I am still getting 11 Class interface or emun errors.
    It says the first error is in the lines that import the GUI buttons
    // Inventory4.java
    // Program will track total inventory items in stock.
    import java.io.*;
    import javax.swing.JFrame;
    public class Inventory4
    {//1
       public static void main (String [] args)  ;
         {//40
           class Item
           {//2
             private double unitPrice;
             private double quantityStock;
             private double inventoryValue;
             private double totalInventory;
             private int itemNumber;
             private String itemName;
                          /** Create a new instance of Item Name */
                       public Item(double UnitPrice,double QuantityStock,int                                                
                                  ItemNumber,String ItemName)
                                              {//3
                                                 itemName = ItemName;
                                                 itemNumber = itemNumber;
                                                 unitPrice = UnitPrice;
                                                quantityStock = QuantityStock;
                                                }//3
                                                           public void setItemName(String ItemName)
                                                          {//4
                                                        itemName = ItemName;
                                                            }//4
                                                           public void setItemNumber(int ItemNumber)
                                                            {//5
                                                       itemNumber = ItemNumber;
                                                             }//5
                                                          public void setUnitPrice(String InventoryHardware)
                                                                   {//6
                                                                 inventoryHardware=InventoryHardware;
                                                                    }//6
                                                          public void setUnitPrice(double UnitPrice)
                                                                    {//7
                                                      unitPrice = UnitPrice;
                                                                     }//7
                                                          public void setQuantityStock(double QuantityStock)
                                                                           {//8
                                                     quantityStock = QuantityStock;
                                                                             }//8
                                                          public String getItemName()
                                                                             {//9
                                                      return itemName;
                                                                                     }//9
                                                          public int getItemNumber()
                                                                                     {//10
                                                      return itemNumber;
                                                                                            }//10
                        public String getInvetoryHardware()
                                                                                              {//11
                        return inventoryHardware;
                                                                                                }//11
                                                          public double getUnitPrice()
                                                                                                   {//12
                                                     return unitPrice;
                                                                                                     }//12
                                                          public double getQuantityStock()
                                                                                                           {//13
                                                    return quantityStock;
                                                                                                            }//13
                                                          public String getInventoryHardware()
                                                                                                                  {//14
                                                    return inventoryHardware;
                                                                                                                   }//14
                                                                               public double computeinventoryValue()
                                                                                                                        {//15
                                                                          return quantityStock * unitPrice;
                                                                                                                            }//15
                                                                                 public double computetotalInventory()
                                                                                                                                {//16
                                                               return totalInventory = totalInventory + inventoryValue;
                                                                                                                                  }//16               
                                                                                     public String toString()
                                                                                                                                  {//17
                                                                               return (itemName);
                                                                                                                                    }//17
            }//2
         }//40
                            // SubItem.java
                            // Sub class to main program
         public class SubItem extends Item
        {//18
                  private String inventoryHardware;
                  private double restockingFee = .05;
                        public SubItem(double UnitPrice,double QuantityStock,int InventoryHardware,int
                                               ItemNumber,String ItemName)
              {//19
                   setUnitPrice(UnitPrice);
                   setQuantityStock(QuantityStock);
                   setItemNumber(ItemNumber);
                   setItemName(ItemName);
                   inventoryHardware = InventoryHardware;
               }//19
                  public void setInventoryHardware(String InventoryHardware)
                       {//20
                     inventoryHardware = InventoryHardware;
                       }//20
                      public int getInventoryHardware()
                               {//21
                      return inventoryHardware;
                                }//21
                              public double computeRestockingFee()
                                       {//22
                    return ((getUnitPrice() * getQuantityStock()) * restockingFee);
                                        }//22
            }//18
                   private static BufferedReader stdin = new BufferedReader( new InputStreamReader(      
                    System.in ) );
                  private static int totalCount = 5;
          public Inventory4()
             {//23
         double unitPrice; // Unit price of each item
         double quantityStock; // Number of items in stock
         double inventoryValue; // Place holder for calculated inventory value
         double totalInventory; // Place holder for calculated total inventory value
         int itemNumber; // Item Number
         String itemName = ""; // Name of each item
                }//23
       public static void main(String[] args)throws IOException
           {//24
         SubItem myItem[];
          myItem = new SubItem[5];
        myItem[0] = new SubItem(10.35,20,4,1,"Traxx");
        myItem[1] = new SubItem(176.34,10,5,2,"Panels");
        myItem[2] = new SubItem(85.34,4,4,3,"Surfaces");
        myItem[3] = new SubItem(1.95,56,6,4,"Brackets");
        myItem[4] = new SubItem(82.34,8,1,5,"Overheads");
             printArray(myItem);
             myItem = sortArray(myItem);
             System.out.println(" Inventory List Sorted by Items \n\n");
              printArray(myItem);
        ItemButton itemButton = new ItemButton(myItem,totalCount); // Make ItemButton
        itemButton.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
        itemButton.setSize( 350,390 ); // Window size
        itemButton.setVisible( true ); // display window
                   } //24 End Main Method
          private static SubItem[] printArray(SubItem[] myItem)
                          {//25
              double totalInventory = 0;
              double restockingFee = 0;
                         for (int i = 0; i<5;++i)
                          {//26
                               System.out.println("\n The Item Number is " + i + myItem.getItemNumber() );
                               System.out.println("\n Item Name is " + myItem.getItemName() );
                               System.out.println("\n Quantity in Stock is " + myItem.getQuantityStock() );
                               System.out.println("\n Inventory Hardware " +                                                    
                  myItem.getInventoryHardware() );
                               System.out.println("\n Inventory Value is $" + myItem.computeinventoryValue          
                               totalInventory = totalInventory + myItem.computeinventoryValue();
                               restockingFee = totalInventory + myItem.computeRestockingFee();
                                  } //26 End For Loop
                                   System.out.println("\n Total Value of all inventory is " + totalInventory);
                                   System.out.println("\n Total Value of all inventory with restock fee $" +             
                                       restockingFee);
                                   return myItem;
                                    }//25
       private static SubItem[] sortArray(SubItem[] myItem)
    {//27
          SubItem temp = new SubItem();
              int i, j;
             int array_size = 5;
             for (i = (array_size - 1); i >= 0; i--)
         {//28
                 for (j = 1; j <= i; j++)
               {//29
                       if (myItem[j-1].getItemName().compareTo(myItem[j].getItemName()) > 1)
                   {//30
                      temp = myItem[j-1];
                      myItem[j-1] = myItem[j];
                      myItem[j] = temp;
                    } //30 End if
                 } //29 End inner for loop
            } //28 End outer for loop
                              return myItem;
    } //27 End Method
    }//1
    // ItemButton.java
    // This will create GUI buttons.
    // Display the Items.
    import java.awt.FlowLayout;//line252
    import java.awt.event.ActionListener;
    import java.awt.event.ActionEvent;
    import javax.swing.JFrame;
    import javax.swing.JButton;
    import javax.swing.JLabel;
    import javax.swing.JTextField;
    import javax.swing.Icon;
    import javax.swing.ImageIcon;
    import javax.swing.JOptionPane;
    import javax.swing.SwingConstants;
      public class ItemButton extends JFrame
          {//31
            private JButton nextJButton; // text button
            private JButton prevJButton; // icon button
            private JLabel lblItemName; // text field with set size
            private JTextField txtItemName; // text field constructed with text
            private JTextField textField3; // text field with text and size
            private JLabel lblItemNumber; // text field with set size
            private JTextField txtItemNumber; // text field constructed with text
            private JLabel lblUnitPrice; // text field with set size
            private JTextField txtUnitPrice; // text field constructed with text
            private JLabel lblQuantityStock; // text field with set size
            private JTextField txtQuantityStock; // text field constructed with text
            private JLabel lblInventoryHardware; // text field with set size
            private JTextField txtInventoryHardware; // text field constructed with text
            private JLabel lblcomputeRestockingFee; // text field with set size
            private JTextField txtcomputeRestockingFee; // text field constructed with text
            private JLabel lblcomputeinventoryValue; // text field with set size
            private JTextField txtcomputeinventoryValue; // text field constructed with text
            private JLabel lblcomputetotalInventory; // text field with set size
            private JTextField txtcomputetotalInventory; // text field constructed with text
                SubItem[] arraySubItem;
                private int currentArrayCounter;
                private int arrayCount;
                   public ItemButton(SubItem[] myItem, int totalArrayCount)
           {//32
                    super ( "Inventory" );
                    arraySubItem = myItem;
                    arrayCount = totalArrayCount;
                    currentArrayCounter = 0;
                    setLayout( new FlowLayout() ); // set frame layout
                         Icon iconNext = new ImageIcon( getClass().getResource( "" ) );
                         Icon iconPrev = new ImageIcon( getClass().getResource( "" ) );
                                   lblItemName = new JLabel( "Item Name ");
                                   add( lblItemName ); // textField3 to JFrame
                                   txtItemName = new JTextField( "", 15 );
                                   add( txtItemName ); // add textField3 to JFrame
                                   lblItemNumber = new JLabel( "Item Number ");
                                   add( lblItemNumber ); // textField3 to JFrame
                                   txtItemNumber = new JTextField( "", 15 );
                                   add( txtItemNumber ); // add textField3 to JFrame
                                   lblUnitPrice = new JLabel( "Unit Price ");
                                  add( lblUnitPrice ); // textField3 to JFrame
                                  txtUnitPrice = new JTextField( "", 15 );
                                  add( txtUnitPrice ); // add textField3 to JFrame
                                  lblQuantityStock = new JLabel( "Quantity Stock " );
                                  add( lblQuantityStock ); // textField3 to JFrame
                                  txtQuantityStock = new JTextField( "", 15 );
                                  add( txtQuantityStock ); // add textField3 to JFrame
                                  lblInventoryHardware = new JLabel( "Inventory Hardware " );
                                 add( lblInventoryHardware ); // textField3 to JFrame
                   txtInventoryHardware = new JTextField( "", 15 );
                                 add( txtInventoryHardware ); // add textField3 to JFrame
                                 lblcomputeRestockingFee = new JLabel( "Restocking Fee ");
                                 add( lblcomputeRestockingFee ); // textField3 to JFrame
                                 txtcomputeRestockingFee = new JTextField( "", 15 );
                                 add( txtcomputeRestockingFee ); // add textField3 to JFrame
                                  lblcomputeinventoryValue = new JLabel( "Inventory Value " );
                                  add( lblcomputeinventoryValue ); // textField3 to JFrame
                                  txtcomputeinventoryValue = new JTextField( "", 15 );
                                  add( txtcomputeinventoryValue ); // add textField3 to JFrame
                                  lblcomputetotalInventory = new JLabel( "Total Inventory ");
                                  add( lblcomputetotalInventory ); // textField3 to JFrame
                                  txtcomputetotalInventory = new JTextField( "", 15 );
                                  add( txtcomputetotalInventory ); // add textField3 to JFrame
                   nextJButton = new JButton( "Next" ); // button with Next
                   prevJButton = new JButton( "Previous"); // button with Prev
                   add(prevJButton);
                   add(nextJButton); // add plainJButton to JFrame
                     ButtonHandler handler = new ButtonHandler();
                                          nextJButton.addActionListener( handler );
                                          prevJButton.addActionListener( handler );
                                          setTextFields();
    } //32 End ButtonFrame constructor
            private class ButtonHandler implements ActionListener
       {//33
          public void actionPerformed( ActionEvent event )
         {//34
               if (event.getActionCommand()== "prevJButton")
             {//35
                  currentArrayCounter++;
              }//35
                 else
                    {//36
                  currentArrayCounter++;
                      }//36
                        setTextFields();
           } //34 End Method ActionPerformed
    } //33 End Private inner class ButtonHandler
    private void setTextFields()
    {//37
               if (currentArrayCounter == arrayCount)
                  {//38
                     currentArrayCounter = 0;
                     }//38
               if (currentArrayCounter < 0)
                    {//39
                       currentArrayCounter = arrayCount;
                      }//39
                           txtItemName.setText(arraySubItem[currentArrayCounter].getItemName());
                           txtItemNumber.setText(arraySubItem[currentArrayCounter].getItemNumber()          
                  +"");
                           txtUnitPrice.setText(arraySubItem[currentArrayCounter].getUnitPrice()+"");
                           txtQuantityStock.setText(arraySubItem[currentArrayCounter].getQuantityStock      
                  ()+"");
                            txtInventoryHardware.setText(arraySubItem                           
    [currentArrayCounter].getInventoryHardWare()+"");
                            txtcomputeRestockingFee.setText(arraySubItem                           
    [currentArrayCounter].computeRestockingFee()+"");
                            txtcomputeinventoryValue.setText(arraySubItem                           
    [currentArrayCounter].computeinventoryValue()+"");
                            txtcomputetotalInventory.setText(arraySubItem                             
    [currentArrayCounter].computetotalInventory()+"");
      }//37
    } //31 End class ItemButton

  • WebDynpro Method from a Class Interface?

    Is possible to call a webdynpro method from a class interface that is register in the WDDOINIT of the same WEBDYNPRO component?
    I register my custom webdynpro screen into FPM_OIF_COMPONENT, now when I execute a FPM action my WebDynpro receives the action but ofcourse WDDOINIT doesn't get triggered again. I need to call my webdynpro code in the class interface so I can update my custom screen.
    SAP does that in their standard screen, Can I do that?
    Jason PV

    As Matt pointed out, your questions indicate that you should start from the basics, then as your knowledge enlarges, go and familarize with more advanced concepts of ABAP Objects. Once you feel a bit comfortable with that, go for BADIs and read a bit about that too.
    In my opinion the best start is to read some book, which covers most of ABAP OO concepts. Personally I would recommend [ABAP Objects: ABAP Programming in SAP NetWeaver|http://www.sap-press.com/product.cfm?account=&product=H1934] as I like this author and had his previous book. This would give you strong foundations of what is going on here. Eventually you will often want to refresh some concepts so you have everything you need in one spot (book).
    Of course if want to save some money, simply look for articles/blogs/wikis in SDN or search in Google. There are plenty of these.
    For start I suggest these series of videoblogs [Basic ABAP OO eLearnings|http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=(J2EE3414800)ID1160600550DB10016261778120999663End?blog=/pub/wlg/15408]
    This will give you rough idea how the OO design should be done.
    Regards
    Marcin

  • Abstract Class & Interface

    Hi ,
    I have a fundamental doubt regarding Abstract Class & Interface!!!
    What is their real benefit...whether we implement an interface or extend an Abstract class we have to write the code for the abstract method in the concrete class.Then where the benefit remained....
    And it is said that Abstract class provide default behaviour...what is the actual meaning of that?
    Thanks & Regards
    Santosh

    In this section we will redesign our OneRowNim game to fit within a hierarchy of classes of two-player games. There are many games that characteristically involve two players: checkers, chess, tic-tac-toe, guessing games, and so forth. However, there are also many games that involve just one player: blackjack, solitaire, and others. There are also games that involve two or more players, such as many card games. Thus, our redesign of OneRowNim as part of a two-player game hierarchy will not be our last effort to design a hierarchy of game-playing classes. We will certainly redesign things as we learn new Java language constructs and as we try to extend our game library to other kinds of games.
    This case study will illustrate how we can apply inheritance and polymorphism, as well as other object-oriented design principles. The justification for revising OneRowNim at this point is to make it easier to design and develop other two-player games. As we have seen, one characteristic of class hierarchies is that more general attributes and methods are defined in top-level classes. As one proceeds down the hierarchy, the methods and attributes become more specialized. Creating a subclass is a matter of specializing a given class.
    8.6.1. Design Goals
    One of our design goals is to revise the OneRowNim game so that it fits into a hierarchy of two-player games. One way to do this is to generalize the OneRowNim game by creating a superclass that contains those attributes and methods that are common to all two-player games. The superclass will define the most general and generic elements of two-player games. All two-player games, including OneRowNim, will be defined as subclasses of this top-level superclass and will inherit and possibly override its public and protected variables and methods. Also, our top-level class will contain certain abstract methods, whose implementations will be given in OneRowNim and other subclasses.
    Generic superclass
    A second goal is to design a class hierarchy that makes it possible for computers to play the game, as well as human users. Thus, for a given two-player game, it should be possible for two humans to play each other, or for two computers to play each other, or for a human to play against a computer. This design goal will require that our design exhibit a certain amount of flexibility. As we shall see, this is a situation in which Java interfaces will come in handy.
    [Page 376]
    Another important goal is to design a two-player game hierarchy that can easily be used with a variety of different user interfaces, including command-line interfaces and GUIs. To handle this feature, we will develop Java interfaces to serve as interfaces between our two-player games and various user interfaces.
    8.6.2. Designing the TwoPlayerGame Class
    To begin revising the design of the OneRowNim game, we first need to design a top-level class, which we will call the TwoPlayerGame class. What variables and methods belong in this class? One way to answer this question is to generalize our current version of OneRowNim by moving any variables and methods that apply to all two-player games up to the TwoPlayerGame class. All subclasses of TwoPlayerGamewhich includes the OneRowNim classwould inherit these elements. Figure 8.18 shows the current design of OneRowNim.
    Figure 8.18. The current OneRowNim class.
    What variables and methods should we move up to the TwoPlayerGame class? Clearly, the class constants, PLAYER_ONE and PLAYER_TWO, apply to all two-player games. These should be moved up. On the other hand, the MAX_PICKUP and MAX_STICKS constants apply just to the OneRowNim game. They should remain in the OneRowNim class.
    The nSticks instance variable is a variable that only applies to the OneRowNim game but not to other two-player games. It should stay in the OneRowNim class. On the other hand, the onePlaysNext variable applies to all two-player games, so we will move it up to the TwoPlayerGame class.
    Because constructors are not inherited, all of the constructor methods will remain in the OneRowNim class. The instance methods, takeSticks() and getSticks(), are specific to OneRowNim, so they should remain there. However, the other methods, getPlayer(), gameOver(), getWinner(), and reportGameState(), are methods that would be useful to all two-player games. Therefore these methods should be moved up to the superclass. Of course, while these methods can be defined in the superclass, some of them can only be implemented in subclasses. For example, the reportGameState() method reports the current state of the game, so it has to be implemented in OneRowNim. Similarly, the getWinner() method defines how the winner of the game is determined, a definition that can only occur in the subclass. Every two-player game needs methods such as these. Therefore, we will define these methods as abstract methods in the superclass. The intention is that TwoPlayerGame subclasses will provide game-specific implementations for these methods.
    [Page 377]
    Constructors are not inherited
    Given these considerations, we come up with the design shown in Figure 8.19. The design shown in this figure is much more complex than the designs used in earlier chapters. However, the complexity comes from combining ideas already discussed in previous sections of this chapter, so don't be put off by it.
    Figure 8.19. TwoPlayerGame is the superclass for OneRowNim and other two-player games.
    To begin with, note that we have introduced two Java interfaces into our design in addition to the TwoPlayerGame superclass. As we will show, these interfaces lead to a more flexible design and one that can easily be extended to incorporate new two-player games. Let's take each element of this design separately.
    [Page 378]
    8.6.3. The TwoPlayerGame Superclass
    As we have stated, the purpose of the TwoPlayerGame class is to serve as the superclass for all two-player games. Therefore, it should define the variables and methods shared by two-player games.
    The PLAYER_ONE, PLAYER_TWO, and onePlaysNext variables and the getPlayer(), setPlayer(), and changePlayer() methods have been moved up from the OneRowNim class. Clearly, these variables and methods apply to all two-player games. Note that we have also added three new variables, nComputers, computer1, computer2, and their corresponding methods, getNComputers() and addComputerPlayer(). We will use these elements to give our games the capability to be played by computer programs. Because we want all of our two-player games to have this capability, we define these variables and methods in the superclass rather than in OneRowNim and subclasses of TwoPlayerGame.
    Note that the computer1 and computer2 variables are declared to be of type IPlayer. IPlayer is an interface containing a single method declaration, the makeAMove() method:
    public interface IPlayer {
    public String makeAMove(String prompt);
    Why do we use an interface here rather than some type of game-playing object? This is a good design question. Using an interface here makes our design more flexible and extensible because it frees us from having to know the names of the classes that implement the makeAMove() method. The variables computer1 and computer2 will be assigned objects that implement IPlayer via the addComputerPlayer() method.
    Game-dependent algorithms
    The algorithms used in the various implementations of makeAMove() are game-dependentthey depend on the particular game being played. It would be impossible to define a game playing object that would suffice for all two-player games. Instead, if we want an object that plays OneRowNim, we would define a OneRowNimPlayer and have it implement the IPlayer interface. Similarly, if we want an object that plays checkers, we would define a CheckersPlayer and have it implement the IPlayer interface. By using an interface here, our TwoPlayerGame hierarchy can deal with a wide range of differently named objects that play games, as long as they implement the IPlayer interface. Using the IPlayer interface adds flexibility to our game hierarchy and makes it easier to extend it to new, yet undefined, classes. We will discuss the details of how to design a game player in Section 8.6.7.
    The IPlayer interface
    Turning now to the methods defined in TwoPlayerGame, we have already seen implementations of getPlayer(), setPlayer(), and changePlayer() in the OneRowNim class. We will just move those implementations up to the superclass. The getNComputers() method is the assessor method for the nComputers variable, and its implementation is routine. The addComputerPlayer() method adds a computer player to the game. Its implementation is as follows:
    [Page 379]
    public void addComputerPlayer(IPlayer player) {
    if (nComputers == 0)
    computer2 = player;
    else if (nComputers == 1)
    computer1 = player;
    else
    return; // No more than 2 players
    ++nComputers;
    As we noted earlier, the classes that play the various TwoPlayerGames must implement the IPlayer interface. The parameter for this method is of type IPlayer. The algorithm we use checks the current value of nComputers. If it is 0, which means that this is the first IPlayer added to the game, the player is assigned to computer2. This allows the human user to be associated with PLAYERONE if this is a game between a computer and a human user.
    If nComputers equals 1, which means that we are adding a second IPlayer to the game, we assign that player to computer1. In either of these cases, we increment nComputers. Note what happens if nComputers is neither 1 nor 2. In that case, we simply return without adding the IPlayer to the game and without incrementing nComputers. This, in effect, limits the number of IPlayers to two. (A more sophisticated design would throw an exception to report an error. but we will leave that for a subsequent chapter.)
    The addComputerPlayer() method is used to initialize a game after it is first created. If this method is not called, the default assumption is that nComputers equals zero and that computer1 and computer2 are both null. Here's an example of how it could be used:
    OneRowNim nim = new OneRowNim(11); // 11 sticks
    nim.add(new NimPlayer(nim)); // 2 computer players
    nim.add(new NimPlayerBad(nim));
    Note that the NimPlayer() constructor takes a reference to the game as its argument. Clearly, our design should not assume that the names of the IPlayer objects would be known to the TwoPlayerGame superclass. This method allows the objects to be passed in at runtime. We will discuss the details of NimPlayerBad in Section 8.6.7.
    The getrules() method is a new method whose purpose is to return a string that describes the rules of the particular game. This method is implemented in the TwoPlayerGame class with the intention that it will be overridden in the various subclasses. For example, its implementation in TwoPlayerGame is:
    public String getRules() {
    return "The rules of this game are: ";
    Overriding a method
    [Page 380]
    and its redefinition in OneRowNim is:
    public String getRules() {
    return "\n*** The Rules of One Row Nim ***\n" +
    "(1) A number of sticks between 7 and " + MAX_STICKS +
    " is chosen.\n" +
    "(2) Two players alternate making moves.\n" +
    "(3) A move consists of subtracting between 1 and\n\t" +
    MAX_PICKUP +
    " sticks from the current number of sticks.\n" +
    "(4) A player who cannot leave a positive\n\t" +
    " number of sticks for the other player loses.\n";
    The idea is that each TwoPlayerGame subclass will take responsibility for specifying its own set of rules in a form that can be displayed to the user.
    You might recognize that defining geTRules() in the superclass and allowing it to be overridden in the subclasses is a form of polymorphism. It follows the design of the toString() method, which we discussed earlier. This design will allow us to use code that takes the following form:
    TwoPlayerGame game = new OneRowNim();
    System.out.println(game.getRules());
    Polymorphism
    In this example the call to getrules() is polymorphic. The dynamic-binding mechanism is used to invoke the getrules() method defined in the OneRowNim class.
    The remaining methods in TwoPlayerGame are defined abstractly. The gameOver() and getWinner() methods are both game-dependent methods. That is, the details of their implementations depend on the particular TwoPlayerGame subclass in which they are implemented.
    This is good example of how abstract methods should be used in designing a class hierarchy. We give abstract definitions in the superclass and leave the detailed implementations up to the individual subclasses. This allows the different subclasses to tailor the implementations to their particular needs, while allowing all subclasses to share a common signature for these tasks. This enables us to use polymorphism to create flexible, extensible class hierarchies.
    Figure 8.20 shows the complete implementation of the abstract TwoPlayerGame class. We have already discussed the most important details of its implementation.
    Figure 8.20. The TwoPlayerGame class
    (This item is displayed on page 381 in the print version)
    public abstract class TwoPlayerGame {
    public static final int PLAYER_ONE = 1;
    public static final int PLAYER_TWO = 2;
    protected boolean onePlaysNext = true;
    protected int nComputers = 0; // How many computers
    // Computers are IPlayers
    protected IPlayer computer1, computer2;
    public void setPlayer(int starter) {
    if (starter == PLAYER_TWO)
    onePlaysNext = false;
    else onePlaysNext = true;
    } // setPlayer()
    public int getPlayer() {
    if (onePlaysNext)
    return PLAYER_ONE;
    else return PLAYER_TWO;
    } // getPlayer()
    public void changePlayer() {
    onePlaysNext = !onePlaysNext;
    } // changePlayer()
    public int getNComputers() {
    return nComputers;
    } // getNComputers()
    public String getRules() {
    return "The rules of this game are: ";
    } // getRules()
    public void addComputerPlayer(IPlayer player) {
    if (nComputers == 0)
    computer2 = player;
    else if (nComputers == 1)
    computer1 = player;
    else
    return; // No more than 2 players
    ++nComputers;
    } // addComputerPlayer()
    public abstract boolean gameOver(); // Abstract Methods
    public abstract String getWinner();
    } // TwoPlayerGame class
    Effective Design: Abstract Methods
    Abstract methods allow you to give general definitions in the superclass and leave the implementation details to the different subclasses.
    [Page 381]
    8.6.4. The CLUIPlayableGame Interface
    We turn now to the two interfaces shown in Figure 8.19. Taken together, the purpose of these interfaces is to create a connection between any two-player game and a command-line user interface (CLUI). The interfaces provide method signatures for the methods that will implement the details of the interaction between a TwoPlayerGame and a UserInterface. Because the details of this interaction vary from game to game, it is best to leave the implementation of these methods to the games themselves.
    Note that CLUIPlayableGame extends the IGame interface. The IGame interface contains two methods that are used to define a standard form of communication between the CLUI and the game. The getGamePrompt() method defines the prompt used to signal the user for a move of some kindfor example, "How many sticks do you take (1, 2, or 3)?" And the reportGameState() method defines how the game will report its current statefor example, "There are 11 sticks remaining." CLUIPlayableGame adds the play() method to these two methods. As we will see shortly, the play() method contains the code that will control the playing of the game.
    [Page 382]
    Extending an interface
    The source code for these interfaces is very simple:
    public interface CLUIPlayableGame extends IGame {
    public abstract void play(UserInterface ui);
    public interface IGame {
    public String getGamePrompt();
    public String reportGameState();
    } // IGame
    Note that the CLUIPlayableGame interface extends the IGame interface. A CLUIPlayableGame is a game that can be played through a CLUI. The purpose of its play() method is to contain the game-dependent control loop that determines how the game is played via a user interface (UI). In pseudocode, a typical control loop for a game would look something like the following:
    Initialize the game.
    While the game is not over
    Report the current state of the game via the UI.
    Prompt the user (or the computer) to make a move via the UI.
    Get the user's move via the UI.
    Make the move.
    Change to the other player.
    The play loop sets up an interaction between the game and the UI. The UserInterface parameter allows the game to connect directly to a particular UI. To allow us to play our games through a variety of UIs, we define UserInterface as the following Java interface:
    public interface UserInterface {
    public String getUserInput();
    public void report(String s);
    public void prompt(String s);
    Any object that implements these three methods can serve as a UI for one of our TwoPlayerGames. This is another example of the flexibility of using interfaces in object-oriented design.
    To illustrate how we use UserInterface, let's attach it to our KeyboardReader class, thereby letting a KeyboardReader serve as a CLUI for TwoPlayerGames. We do this simply by implementing this interface in the KeyboardReader class, as follows:
    public class KeyboardReader implements UserInterface
    [Page 383]
    As it turns out, the three methods listed in UserInterface match three of the methods in the current version of KeyboardReader. This is no accident. The design of UserInterface was arrived at by identifying the minimal number of methods in KeyboardReader that were needed to interact with a TwoPlayerGame.
    Effective Design: Flexibility of Java Interfaces
    A Java interface provides a means of associating useful methods with a variety of different types of objects, leading to a more flexible object-oriented design.
    The benefit of defining the parameter more generally as a UserInterface instead of as a KeyboardReader is that we will eventually want to allow our games to be played via other kinds of command-line interfaces. For example, we might later define an Internet-based CLUI that could be used to play OneRowNim among users on the Internet. This kind of extensibilitythe ability to create new kinds of UIs and use them with TwoPlayerGamesis another important design feature of Java interfaces.
    Generality principle
    Effective Design: Extensibility and Java Interfaces
    Using interfaces to define useful method signatures increases the extensibility of a class hierarchy.
    As Figure 8.19 shows, OneRowNim implements the CLUIPlayableGame interface, which means it must supply implementations of all three abstract methods: play(), getGamePrompt(), and reportGameState().
    8.6.5. Object-Oriented Design: Interfaces or Abstract Classes?
    Why are these methods defined in interfaces? Couldn't we just as easily define them in the TwoPlayerGame class and use inheritance to extend them to the various game subclasses? After all, isn't the net result the same, namely, that OneRowNim must implement all three methods.
    These are very good design questions, exactly the kinds of questions one should ask when designing a class hierarchy of any sort. As we pointed out in the Animal example earlier in the chapter, you can get the same functionality from an abstract interface and an abstract superclass method. When should we put the abstract method in the superclass, and when does it belong in an interface? A very good discussion of these and related object-oriented design issues is available in Java Design, 2nd Edition, by Peter Coad and Mark Mayfield (Yourdan Press, 1999). Our discussion of these issues follows many of the guidelines suggested by Coad and Mayfield.
    Interfaces vs. abstract methods
    We have already seen that using Java interfaces increases the flexibility and extensibility of a design. Methods defined in an interface exist independently of a particular class hierarchy. By their very nature, interfaces can be attached to any class, and this makes them very flexible to use.
    Flexibility of interfaces
    Another useful guideline for answering this question is that the superclass should contain the basic common attributes and methods that define a certain type of object. It should not necessarily contain methods that define certain roles that the object plays. For example, the gameOver() and getWinner() methods are fundamental parts of the definition of a TwoPlayerGame. One cannot define a game without defining these methods. By contrast, methods such as play(), getGamePrompt(), and reportGameState() are important for playing the game but they do not contribute in the same way to the game's definition. Thus these methods are best put into an interface. Therefore, one important design guideline is:
    [Page 384]
    Effective Design: Abstract Methods
    Methods defined abstractly in a superclass should contribute in a fundamental way to the basic definition of that type of object, not merely to one of its roles or its functionality.
    8.6.6. The Revised OneRowNim Class
    Figure 8.21 provides a listing of the revised OneRowNim class, one that fits into the TwoPlayerGame class hierarchy. Our discussion in this section will focus on the features of the game that are new or revised.
    Figure 8.21. The revised OneRowNim class, Part I.
    (This item is displayed on page 385 in the print version)
    public class OneRowNim extends TwoPlayerGame implements CLUIPlayableGame {
    public static final int MAX_PICKUP = 3;
    public static final int MAX_STICKS = 11;
    private int nSticks = MAX_STICKS;
    public OneRowNim() { } // Constructors
    public OneRowNim(int sticks) {
    nSticks = sticks;
    } // OneRowNim()
    public OneRowNim(int sticks, int starter) {
    nSticks = sticks;
    setPlayer(starter);
    } // OneRowNim()
    public boolean takeSticks(int num) {
    if (num < 1 || num > MAX_PICKUP || num > nSticks)
    return false; // Error
    else // Valid move
    { nSticks = nSticks - num;
    return true;
    } // else
    } // takeSticks()
    public int getSticks() {
    return nSticks;
    } // getSticks()
    public String getRules() {
    return "\n*** The Rules of One Row Nim ***\n" +
    "(1) A number of sticks between 7 and " + MAX_STICKS +
    " is chosen.\n" +
    "(2) Two players alternate making moves.\n" +
    "(3) A move consists of subtracting between 1 and\n\t" +
    MAX_PICKUP + " sticks from the current number of sticks.\n" +
    "(4) A player who cannot leave a positive\n\t" +
    " number of sticks for the other player loses.\n";
    } // getRules()
    public boolean gameOver() {   /*** From TwoPlayerGame */
    return (nSticks <= 0);
    } // gameOver()
    public String getWinner() {        /*** From TwoPlayerGame */
    if (gameOver()) //{
    return "" + getPlayer() + " Nice game.";
    return "The game is not over yet."; // Game is not over
    } // getWinner()
    The gameOver() and getWinner() methods, which are nowinherited from the TwoPlayerGame superclass, are virtually the same as in the previous version. One small change is that getWinner() now returns a String instead of an int. This makes the method more generally useful as a way of identifying the winner for all TwoPlayerGames.
    Similarly, the getGamePrompt() and reportGameState() methods merely encapsulate functionality that was present in the earlier version of the game. In our earlier version the prompts to the user were generated directly by the main program. By encapsulating this information in an inherited method, we make it more generally useful to all TwoPlayerGames.
    Inheritance and generality
    The major change to OneRowNim comes in the play() method, which controls the playing of OneRowNim (Fig. 8.22). Because this version of the game incorporates computer players, the play loop is a bit more complex than in earlier versions of the game. The basic idea is still the same: The method loops until the game is over. On each iteration of the loop, one or the other of the two players, PLAYER_ONE or PLAYER_TWO, takes a turn making a movethat is, deciding how many sticks to pick up. If the move is a legal move, then it becomes the other player's turn.
    Figure 8.22. The revised OneRowNim class, Part II.
    (This item is displayed on page 386 in the print version)
    /** From CLUIPlayableGame */
    public String getGamePrompt() {
    return "\nYou can pick up between 1 and " +
    Math.min(MAX_PICKUP,nSticks) + " : ";
    } // getGamePrompt()
    public String reportGameState() {
    if (!gameOver())
    return ("\nSticks left: " + getSticks() +
    " Who's turn: Player " + getPlayer());
    else
    return ("\nSticks left: " + getSticks() +
    " Game over! Winner is Player " + getWinner() +"\n");
    } // reportGameState()
    public void play(UserInterface ui) { // From CLUIPlayableGame interface
    int sticks = 0;
    ui.report(getRules());
    if (computer1 != null)
    ui.report("\nPlayer 1 is a " + computer1.toString());
    if (computer2 != null)
    ui.report("\nPlayer 2 is a " + computer2.toString());
    while(!gameOver()) {
    IPlayer computer = null; // Assume no computers
    ui.report(reportGameState());
    switch(getPlayer()) {
    case PLAYER_ONE: // Player 1's turn
    computer = computer1;
    break;
    case PLAYER_TWO: // Player 2's turn
    computer = computer2;
    break;
    } // cases
    if (computer != null) {                           // If computer's turn
    sticks = Integer.parseInt(computer.makeAMove(""));
    ui.report(computer.toString() + " takes " + sticks + " sticks.\n");
    } else {                                          // otherwise, user's turn
    ui.prompt(getGamePrompt());
    sticks =
    Integer.parseInt(ui.getUserInput()); // Get user's move
    if (takeSticks(sticks)) // If a legal move
    changePlayer();
    } // while
    ui.report(reportGameState()); // The game is now over
    } // play()
    } // OneRowNim class
    Let's look now at how the code decides whether it is a computer's turn to move or a human player's turn. Note that at the beginning of the while loop, it sets the computer variable to null. It then assigns computer a value of either computer1 or computer2, depending on whose turn it is. But recall that one or both of these variables may be null, depending on how many computers are playing the game. If there are no computers playing the game, then both variables will be null. If only one computer is playing, then computer1 will be null. This is determined during initialization of the game, when the addComputerPlayer() is called. (See above.)
    In the code following the switch statement, if computer is not null, then we call computer.makeAMove(). As we know, the makeAMove() method is part of the IPlayer interface. The makeAMove() method takes a String parameter that is meant to serve as a prompt, and returns a String that is meant to represent the IPlayer's move:
    public interface IPlayer {
    public String makeAMove(String prompt);
    [Page 385]
    In OneRowNim the "move" is an integer, representing the number of sticks the player picks. Therefore, in play() OneRowNim has to convert the String into an int, which represents the number of sticks the IPlayer picks up.
    On the other hand, if computer is null, this means that it is a human user's turn to play. In this case, play() calls ui.getUserInput(), employing the user interface to input a value from the keyboard. The user's input must also be converted from String to int. Once the value of sticks is set, either from the user or from the IPlayer, the play() method calls takeSticks(). If the move is legal, then it changes whose turn it is, and the loop repeats.
    [Page 386]
    There are a couple of important points about the design of the play() method. First, the play() method has to know what to do with the input it receives from the user or the IPlayer. This is game-dependent knowledge. The user is inputting the number of sticks to take in OneRowNim. For a tic-tac-toe game, the "move" might represent a square on the tic-tac-toe board. This suggests that play() is a method that should be implemented in OneRowNim, as it is here, because OneRowNim encapsulates the knowledge of how to play the One-Row Nim game.
    Encapsulation of game-dependent knowledge
    [Page                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         

  • Could anyone tell me what is a class

    Hi gurus,
                  could anyone explain me in detail what does a class mean (se24) in sap and for what it is used? i have tried my best to know about it. it is like greek and latin to me.
    Thanks in advance,
    Ramana

    Classes describe objects. From a technical point of view, objects are runtime instances of a class. In theory, you can create any number of objects based on a single class. Each instance (object) of a class has a unique identity and its own set of values for its attributes.
    classes consist of ABAP source code, enclosed in the ABAP statements CLASS ... ENDCLASS. A complete class definition consists of a declaration part and, if required, an implementation part. The declaration part of a class <class> is a statement block:
    CLASS <class> DEFINITION.
    ENDCLASS.
    It contains the declaration for all components (attributes, methods, events) of the class. When you define local classes, the declaration part belongs to the global program data. You should therefore place it at the beginning of the program.
    If you declare methods in the declaration part of a class, you must also write an implementation part for it. This consists of a further statement block:
    CLASS <class> IMPLEMENTATION.
    ENDCLASS.
    The implementation part of a class contains the implementation of all methods of the class. The implementation part of a local class is a processing block. Subsequent coding that is not itself part of a processing block is therefore not accessible.
    Structure of a Class
    The following statements define the structure of a class:
    A class contains components
    Each component is assigned to a visibility section
    Classes implement methods
    The following sections describe the structure of classes in more detail.
    Class Components
    The components of a class make up its contents. All components are declared in the declaration part of the class. The components define the attributes of the objects in a class. When you define the class, each component is assigned to one of the three visibility sections, which define the external interface of the class. All of the components of a class are visible within the class. All components are in the same namespace. This means that all components of the class must have names that are unique within the class.
    There are two kinds of components in a class - those that exist separately for each object in the class, and those that exist only once for the whole class, regardless of the number of instances. Instance-specific components are known as instance components. Components that are not instance-specific are called static components.
    In ABAP Objects, classes can define the following components. Since all components that you can declare in classes can also be declared in interfaces, the following descriptions apply equally to interfaces.
    Attributes
    Attributes are internal data fields within a class that can have any ABAP data type. The state of an object is determined by the contents of its attributes. One kind of attribute is the reference variable. Reference variables allow you to create and address objects. Reference variables can be defined in classes, allowing you to access objects from within a class.
    Instance Attributes
    The contents of instance attributes define the instance-specific state of an object. You declare them using the DATA statement.
    Static Attributes
    The contents of static attributes define the state of the class that is valid for all instances of the class. Static attributes exist once for each class. You declare them using the CLASS-DATA statement. They are accessible for the entire runtime of the class.
    All of the objects in a class can access its static attributes. If you change a static attribute in an object, the change is visible in all other objects in the class.
    Methods
    Methods are internal procedures in a class that define the behavior of an object. They can access all of the attributes of a class. This allows them to change the data content of an object. They also have a parameter interface, with which users can supply them with values when calling them, and receive values back from them The private attributes of a class can only be changed by methods in the same class.
    The definition and parameter interface of a method is similar to that of function modules. You define a method <met> in the definition part of a class and implement it in the implementation part using the following processing block:
    METHOD <meth>.
    ENDMETHOD.
    You can declare local data types and objects in methods in the same way as in other ABAP procedures (subroutines and function modules). You call methods using the CALL METHOD statement.
    Instance Methods
    You declare instance methods using the METHODS statement. They can access all of the attributes of a class, and can trigger all of the events of the class.
    Static Methods
    You declare static methods using the CLASS-METHODS statement. They can only access static attributes and trigger static events.
    Special Methods
    As well as normal methods, which you call using CALL METHOD, there are two special methods called CONSTRUCTOR and CLASS_CONSTRUCTOR, which are automatically called when you create an object (CONSTRUCTOR) or when you first access the components of a class (CLASS_CONSTRUCTOR).
    Events
    Objects or classes can use events to trigger event handler methods in other objects or classes. In a normal method call, one method can be called by any number of users. When an event is triggered, any number of event handler methods can be called. The link between the trigger and the handler is not established until runtime. In a normal method call, the calling program determines the methods that it wants to call. These methods must exist. With events, the handler determines the events to which it wants to react. There does not have to be a handler method registered for every event.
    The events of a class can be triggered in the methods of the same class using the RAISE EVENT statement. You can declare a method of the same or a different class as an event handler method for the event <evt> of class <class> using the addition FOR EVENT <evt> OF <class>.
    Events have a similar parameter interface to methods, but only have output parameters. These parameters are passed by the trigger (RAISE EVENT statement) to the event handler method, which receives them as input parameters.
    The link between trigger and handler is established dynamically in a program using the SET HANDLER statement. The trigger and handlers can be objects or classes, depending on whether you have instance or static events and event handler methods. When an event is triggered, the corresponding event handler methods are executed in all registered handling classes.
    Instance Events
    You declare instance events using the EVENTS statement. An instance event can only be triggered in an instance method.
    Static Events
    You declare static events using the CLASS-EVENTS statement. All methods (instance and static methods) can trigger static events. Static events are the only type of event that can be triggered in a static method.
    See also Triggering and Handling Events.
    Types
    You can define your own ABAP data types within a class using the TYPES statement. Types are not instance-specific, and exist once only for all of the objects in a class.
    Constants
    Constants are special static attributes. You set their values when you declare them, and they can then no longer be changed. You declare them using the CONSTANTS statement. Constants are not instance-specific, and exist once only for all of the objects in a class.
    Visibility Sections
    You can divide the declaration part of a class into up to three visibility areas:
    CLASS <class> DEFINITION.
      PUBLIC SECTION.
      PROTECTED SECTION.
      PRIVATE SECTION.
    ENDCLASS.
    These areas define the external visibility of the class components, that is, the interface between the class and its users. Each component of a class must be assigned to one of the visibility sections.
    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. Protected components form a special interface between a class and its subclasses. Since inheritance is not active in Release 4.5B, the protected section currently has the same effect as the private section.
    Private Section
    Components that you declare in the private section are only visible in the methods of the same class. The private components are not part of the external interface of the class.

  • Error in code, cannot figure it out. - class, interface, or enum expected

    IT is telling me i have an error in line 22 and it says class, interface, or enum expected
    import java.util.Scanner
    * @(#)Blahh.java
    * Blahh application
    * @author
    * @version 1.00 2010/1/29
    public class Blahh {
    public static void main(String[] args) {
         // TODO, add your application code
         System.out.println("Hello World!");
    // PURPOSE: An exercise in tracing a program and understanding
    // assignment statements and expressions.
    import java.util.Scanner
    Public class Trace
    public static void main (String[] args)
    int one, two, three;
    double what;
    Scanner scan = new Scanner(System.in);
    System.out.print ("Enter two integers: ");
    one = scan.nextInt();
    two = scan.nextInt();
    system.out.print("Enter a floating point number: ");
    what = scan.nextDouble();
    three = 4 * one + 5 * two;
    two = 2 * one;
    system.out.println ("one " + two + ":" + three);
    one = 46 / 5 * 2 + 19 % 4;
    three = one + two;
    what = (what + 2.5) / 2;
    System.out.println (what + " is what!");
    }}

    youngtron92 wrote:
    IT is telling me i have an error in line 22 and it says class, interface, or enum expected
    import java.util.Scanner
    * @(#)Blahh.java
    * Blahh application
    * @author
    * @version 1.00 2010/1/29
    public class Blahh {
    public static void main(String[] args) {
         // TODO, add your application code
         System.out.println("Hello World!");
    // PURPOSE: An exercise in tracing a program and understanding
    // assignment statements and expressions.
    import java.util.Scanner
    Public class Trace
    public static void main (String[] args)
    int one, two, three;
    double what;
    Scanner scan = new Scanner(System.in);
    System.out.print ("Enter two integers: ");
    one = scan.nextInt();
    two = scan.nextInt();
    system.out.print("Enter a floating point number: ");
    what = scan.nextDouble();
    three = 4 * one + 5 * two;
    two = 2 * one;
    system.out.println ("one " + two + ":" + three);
    one = 46 / 5 * 2 + 19 % 4;
    three = one + two;
    what = (what + 2.5) / 2;
    System.out.println (what + " is what!");
    }}Is that all a single source file? The import statement(s) need to be at the top, and each import has to be terminated by a semicolon.
    Also this is wrong. Case matters.
    Public class Trace

  • Track public classes, interfaces and methods by ID

    Hi All,
    I'm wondering whether there is a tool to assign a unique ID to classes, interfaces and methods (eg. within Javadoc) and track these IDs.
    The reason I'd need such a feature is that I'd like to do requirements tracking in an easy but complete way. I have a document containing functional specifications (with IDs) and on the other side there is the source code; where the javadoc of the public methods and classes is my software specification. What I now want to do is make a link between the IDs in the functional spec to the IDs in the sofware spec (ie. the source code).
    Does anybody know of such a tool (commercial or not)?
    Thanks,
    Daniel

    I'm a bit confused as to whether or not I understand you correctly. Please tell me if the following pseudocode is somewhat like the solution you are looking for:
    class MethodFunctionality {
       private Class methodClass;
       private String methodSignature;
       private List methodFunctions;
        *   Returns true if the method is used for the specified
        *   requirement, false otherwise.
       public boolean fulfills(int requirementId) {
          if methodFunctions.contains(requirementId)
             return true;
          else
             return false;
       public String getMethodSignature() {
          return this.methodSingature;
       public Class getMethodClass() {
          return this.methodClass;
        *   Returns an array with IDs of each functional
        *   requirement covered by the method.
       public int[] getCoverage() {
          return this.methodFunctions;
    class ClassFunctionality {
       private Map methodDetails;
       private List classFunctions;
       public MethodFunctionality getMethodDetails(String methodSignature) {
          return (MethodFunctionality) this.methodDetails.get(methodSignature);
        *   Returns true if the class is used for the specified
        *   requirement, false otherwise.
       public boolean fulfills(int requirementId) {
          if classFunctions.contains(requirementId)
             return true;
          else
             return false;
        *   Returns an array with IDs of each functional
        *   requirement covered by the class.
       public int[] getCoverage() {
          return this.classFunctions;
    }Mapping classes and methods to functionality like this would both allow you to query each class and method for all the functional requirements they claim to cover and would allow you to collect all classes and methods involved for a particular functional requirement.

  • Date Class Interfaces

    Hello all,
    I am creating a presentation and need to speak intelligently on Date Class interfaces. Could anyone give me a description of some of these and what their purpose would be? Also, can you provide any examples?
    Thanks,
    Seawall

    You need to someone who speaks the same language
    natively as you do.
    Too much of your intent is being lost intranslation. Sorry.
    I am from North Carolina. I am speaking english.
    English maybe. Understandable Java terminology not so much.
    I really don't understand what is wrong with my
    question. I think two people have told you know that your question makes no sense. I am trying to imagine a presentation on the java.util.Date class and I really don't know what it would consist of.
    >
    I am trying to give examples of objects, instance
    variables, methods, messages, interfaces,
    encapsulation, inheritance, and polymorphism for the
    Class "date". Why?
    Is the point of this project a homework assignment whereby you demonstrate understanding OO by discussion of a particular API and how it meets/fits/demonstrates these OO concepts?
    If that is the case I would suggest that you start by getting a better understanding of OO concepts in general. The question, if it is as described above, is easy to solve IF you understand OO in the Java way.
    I suggest starting here http://java.sun.com/docs/books/tutorial/java/concepts/index.html

  • Hi ,info need on container creation,methods,class,interface....

    hi ppl,
              Can anybody give me information on what is and how to create
    container creation,methods,class,interface....with programs.

    >
    priyank dev wrote:
    > hi ppl,
    >           Can anybody give me information on what is and how to create
    >  container creation,methods,class,interface....with programs.
    Hi Dev,
    Interface is just the skeleton of the class definition.
    If you want to have your own code for all or any of the methods that interface is havings then you can create an instance of that interface and implement those methods with you own code.
    That is the advantage of object oriented programming. And if you want to use the standard method or original method's functionality then you have call the method along with the class which implemented it like below
    class => method1
    For Imore information on interfaces Check this link.
    http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b6254f411d194a60000e8353423/frameset.htm
    For creating classes you can follow this procedure.
    Go with abap dictionary->select database table->provide the table for dev classs eg. V_TDEVC-> go for display option-> select utilities->select contents option-> select create dev class,
    provide the name and short text,software component->create req.no.
    with this dev class will be created.
    Thanks
    Nitesh
    Edited by: Nitesh Kumar on Nov 18, 2008 10:56 AM

  • RFC Vs Class/Interface

    Hi,
    I have created a Class using SE80 using Class/Interface option. Can anybody please explain me what will be difference between
    RFC and Class Interface. Whether Class Interface can be used as same RFC?
    If yes how class can be accessed from other legacy systems?
    Whether we need to right a wrapper RFC for this class to access?.
    I heard BAPI's also global classes that have BOR entries.How these BAPI are accessing from legacy?
    I am very new to ABAP
    Thanks
    SAR

    Please don't double post your questions....
    RFC Vs Class/Interface
    Sorry that I can't answer you question, but haven't work with Class/Interface yet....
    Greetings,
    Blag.

  • CMD executions in table class interface via ABAP

    Hi SDN Community,
    Would it be possible to code in ABAP , and Command statements that can be placed in the web templates.
    can this be done in the Table class interface.
    For example, the command to expand a hierarchy node that is produced in RSRT2, is
    CMD=SET_DRILL_STATE&DATA_PROVIDER=DP=234D5W1FC9W6311O66UCVSRN9E2&IOBJNM=4D5W27AIW32VTOY02REHCSL6Y&TOGGLE_STATE=X
    How can this if possible be placed in a Table Class Interface, and coded in ABAP to achieve the expansion of the hierarchy node.
    thank you.
    Simon

    Hi Thomas,
    I have been working with a brilliant ABAP'er, and together we
    implemented a solution in the START method, that makes use of the
    following methods and expands all the hierarchy nodes at start.
    And this class can be omitted in the Print all view we have formulated
    as only a collapsed view has been specified there.
    thank you.
    Simon
    I found this all in that class interface CL_RSR_REQUEST
    for N_R_REQUEST
    for N_R_DATA_SET
    Initial Value: Set Drilldown State of a Hierarchy
    Description: 'SET_DRILL_STATE'
    this looks like the method that gets executed. what do you think?
    can you code this in the program
    constants C_CMD_SET_DRILL_STATE type RSRCMDID
    value 'SET_DRILL_STATE'. "#EC NOTEXT
    methods SET_DRILL_STATE
    importing
    value(I_AXIS) type RRXAXIS optional
    value(I_POSITION) type I optional
    value(I_FOCUS_IOBJNM) type RSIOBJNM optional
    value(I_DRILLSTATE) type RRXDRILLSTATE optional
    value(I_TOGGLE) type RS_BOOL default RS_C_FALSE
    !I_R_PARAMETER type ref to CL_RSR_PARAMETER optional
    exporting
    !E_KEEP_LAST_LINES type I
    !E_KEEP_FIRST_LINES type I
    !E_NEW_LINES_FROM type I
    !E_NEW_LINES_TO type I
    !E_NODE_POSITION_FROM type I
    !E_NODE_POSITION_TO type I
    exceptions
    NO_PROCESSING
    X_MESSAGE .

  • What is Position class?

    hi guys,
    can any one tell me what kind of class is the Position? I searched for it in this web site.
    but couldnt find it.
    any comment
    abdul

    It's actually an interface, not a class.
    http://java.sun.com/j2se/1.4/docs/api/javax/swing/text/Position.html

Maybe you are looking for

  • How can I move one CC program (Photoshop) to another hard drive?

    So I generally love everything about Adobe CC, but there's one huge downside I can't find a work around to - I want Photoshop (which I use 95% of the time) to be installed on my SSD, but the SSD isn't big enough to have the entire CC suite installed

  • Search instring value of Variable in customer exit of bex report

    Hello experts- I have a situation where I need to search the records based on value  of a variable input in selection screen of bex report and according to that i need to show the results in report. Ex- if we have a material characteristics on select

  • Dynamic language RFC communication channel

    Hi, Is it somehow possible to dynamically determine the language to be used to send an RFC request with the RFC Receiver Adapter? I don't see any variable substitution possibility, so I assume it is not possible to do so. What would be the nicest way

  • Import Premiere Pro Sequence grayed out in Adobe Dynamic Link

    I'm using PPro CC, and encore CS6. I have created a finished sequence in Premiere Pro, and I want to bring it into Encore. When I go to -> file -> adobe dynamic link, the premiere pro sequence option is grayed out. Why?

  • One Parameter, multiple Conditions - Old version of Disco?

    Hi, I have a report where I want to base a number of conditions on a single parameter. The version of Disco I am using doesn't seem to allow me to do this. There is no 'select parameter' option. Disco Desktop version is: 4.1.47.09.00 - old!!! Seems l