How to declare abstract method

given - work worked at first .
fact - then i went to add new entity object names ScottOafE0 . went through all the next sand finished. a package and entity obj already exist. i also tried to put a new package and ScottOafAM in a seperate place. still a no go
when i went to run the form it errors out w/ below msg.
Error(14,8): class xxxoaf.oracle.apps.xxuab.hr.newforms.server.ScottOafEOImpl should be declared abstract; it does not define method setLastUpdateLogin(oracle.jbo.domain.Number) in class oracle.apps.fnd.framework.server.OAEntityImpl
Guess - i tired to put import oracle.apps.fnd.framework.server.OAEntityImpl in the controller file . didnt work
any idea how to define abstract method ?
thanks
scott

You dont need to define your class as abstract, that would not resolve your issue, what is happening is
oracle.apps.fnd.framework.server.OAEntityImpl is a abstract class, and has a method declared as setLastUpdateLogin(oracle.jbo.domain.Number) in class
Now, any class (xxxoaf.oracle.apps.xxuab.hr.newforms.server.ScottOafEOImpl ) extending from this class must either provide a definition to this method (provide the implementation logic), or must itself be declared abstract.
We had a discussion on this issue in the forum , look for the thread.
Thanks
Tapash

Similar Messages

  • How does the abstract method do its job?

    //SSLSocketFactory factory =
              (SSLSocketFactory)SSLSocketFactory.getDefault();
    //SSLSocket socket =
              (SSLSocket)factory.createSocket("www.verisign.com", 443);
    The method 'createSocket(String host, int port)' is an abstract method, I'm confused that how this method did created a socket with an empty implementation?
    Can you help?

    //SSLSocketFactory factory =
    (SSLSocketFactory)SSLSocketFactory.getDefault();
    //SSLSocket socket =
    (SSLSocket)factory.createSocket("www.verisign.com", 443);
    The method 'createSocket(String host, int port)' is an abstract method, I'm confused that how this method did created a socket with an empty implementation?
    Can you help?
    The SSLSocketFactory's getDefault() method has an implentation that will return a class of type SSLSocketFactory. Example (this may not be the code but it's close):
    public abstract class SSLSocketFactory ... {
       ... // other methods
       public SSLSocketFactory getDefault(){
          return new SSLSocketFactoryImpl();
       private class SSLSocketFactoryImpl extends SSLSocketFactory {
          // concrete implementation of methods...
          public SSLSocket createSocket(..., ..., ....){
             return new SSLSocketImpl(..., ..., ...);
          private class SSLSocketImpl extends SSLSocket {
             SSLSocketImpl(..., ..., ...){
             // concrete implementation of methods...
    }As you can see here it is not really the SSLSocketFactory and SSLSocket that you are getting. You are getting concrete implementations of this class.
    To prove to you, change your code to this:
    //SSLSocketFactory factory =
    (SSLSocketFactory)SSLSocketFactory.getDefault();
    //SSLSocket socket = (SSLSocket)factory.createSocket("www.verisign.com", 443);
    System.out.prinntln(factory.getClass().getName());
    System.out.prinntln(socket.getClass().getName());This will show you the actual name of the classes.

  • ByteBuffer: how come the abstract methods work?

    I am confused about the abstract methods in ByteBuffer class. Many of the methods in that class are declared abstract but yet I am able to use them without a problem.
    For example, put(byte b) is declared abstract in the java docs. But I am able to use that method ( I did not have to extend ByteBuffer and implement this method). I know I must be missing something here...any help would be appreciated.
    thanks

    Those responses should certainly do the trick. But I love hearing myself type, so here's an example:abstract class Fred
         public abstract void hiThere();
    class SubFred extends Fred
         public void hiThere() { println("Greetings Professor Falken"); }
    }Somewhere some method says it returns an object of type Fred. To do this they might (as far as you know) create an instance of SubFred and return that to you. SubFred is of type Fred. Your code doesn't know or care (usually) what the ACTUAL class is, as long as it matches what you expect Fred to be from the documentation.

  • Abstract methods in interface?

    hi, i dun feel that an interface can have abstract methods although the compiler doesn't complain. but i still see developer declares abstract methods in the interface. any clarification on this? thx
    cy

    hi, i dun feel that an interface can have abstract
    methods although the compiler doesn't complain. but i
    still see developer declares abstract methods in the
    interface. any clarification on this? thx
    cyThose developers are just a bit verbose, all methods in an interface are public and abstract.
    Kaj

  • Static abstract methods - how can I avoid them?

    Hi everybody,
    just found out that java doesn't allow static abstract methods nor static methods in interfaces. Although I understand the reasons, I can't think of how to change my design to gain the required behavior without the need of static abstract methods.
    Here's what I want to do and how my thoughts lead to static abstract methods:
    ClassA provides access to native code (c-dll, using jna). The path to the dll can be set programmatically. Here's a draft of the class:
    public ClassA {
       private static String path;
       public static void setRealtivePath(String path) {
          //check if path exists and is not null -> get absolute path
          setPath(path);
       public static void setPath(String absolutePath) {
          this.path = path;
      //code to provide access to native lib
    }There is some more classes which provide access to different dlls (therefore the code for accessing the dlls differs from ClassA). Although this works, the setRelativePath method has to be implemented in each class. I thought it would be nice to put this method into a abstract super class that looks like this:
    public abstract class superClass {
       public static void setRelativePath(String path) {
          //check if path exists and is not null -> get absolute path
          setPath(path);
       //force inherting class to implement a static method
       public static abstract void setPath(String absolutePath);
    }thus simplifying ClassA and it's look-a-likes:
    public ClassA {
       private static String path;
       @Override
       public static void setPath(String absolutePath) {
          this.path = path;
      //code to provide access to native lib
    }Since static abstract methods (and overriding static methods) is not allowed, this doesn't work.
    I hope someone can catch my idea ;). Any suggestions how to do this in a nice clean way?
    Thanks in advance,
    Martin
    Edited by: morty2 on Jul 22, 2009 2:57 AM

    First of all, thanks a lot for your answer.
    YoungWinston wrote:
    Actually, you can "override" static methods (in that you can write the same method for both a subclass and a superclass, providing the superclass method isn't final); it's just that it doesn't work polymorphically. The "overriding" method masks the overridden one and the determination of what gets called is entirely down to the declared type.Yes, I know that. There's one problem: Your suggestion means that I simply have to drop the abstract modifier in the super classes setPath method. However, since the super class calls the setPath method (and not the inherting classes!) it will always be the super classes' method being called.
    YoungWinston wrote:
    Why are you so concerned with making everything static? Seems to me that the simplest solution would be to make all the contents instance-based.I want ClassA and it's look-a-likes to be set up properly at application start up, be accessible quite anytime and easily, they don't do anything themselves except for setting the path and calling into the native library which does the math. (Compareable to how you call e.g. Math.cos()). Therefore I don't think that an instance-based solution would be a better approach.
    YoungWinston wrote:
    Furthermore, you could make the class immutable; which might be a good thing - I'm not sure I'd want someone being able to change the pathname after I've >set up a class like this.Thanks for that!
    PS: As mentioned in my first post, I do have a working solution. However, I'm really corious about finding a nicer and cleaner way to do it!
    Martin

  • Missing method body or declare abstract error

    Hi!
    I have been working on this simple Java 1.3.1 program for three days now and cannot figure out what I am doing wrong. If anyone has done the "Building an Application" tutorial in the New to Java Programming Center, you might recognize the code. I am trying to set up a frame with panels first using the BorderLayout and then the FlowLayout within each section of the BorderLayout. It will have textfields and checkboxes. I am working on the code to retrieve the user input from the text boxes and also to determine which checkbox the user has checked. Here is my code: (ignore my irrelivent comments!)
    import java.awt.*;
    import javax.swing.*;
    import java.io.*;
    import java.awt.event.*;
    import java.awt.Color.*;
    import java.awt.Image.*;
    //Header Comment for a Routine/Method
    //This method gathers the input text supplied by the user from five text fields on the Current
    //Purchase tab of the tabbed pane of the MPGLog.java program. The way it gathers the text
    //depends on the current processing state, which it retrieves on its own. It saves the text to
    //a text file called textinput.txt.
    public class CollectTextInput extends JPanel implements ActionListener
    { // Begin class
         //Declare all the objects needed first.
         // These are the text fields
         private JTextField currentMileage;
         private JTextField numofGallonsBought;
         private JTextField dateofPurchase;
         private JTextField pricePerGallon;
         private JTextField gasBrand;
         // Declaring the Labels to go with each TextField
         private JLabel lblcurrentMileage;
         private JLabel lblnumofGallonsBought;
         private JLabel lbldateofPurchase;
         private JLabel lblpricePerGallon;
         private JLabel lblgasBrand;
         // Declaring the Checkboxes for the types of gas bought
         private JCheckBox chbxReg;
         private JCheckBox chbxSuper;
         private JCheckBox chbxUltra;
         private JCheckBox chbxOther;
         private JCheckBox chbxHigher;
         private JCheckBox chbxLower;
         // Declaring the Buttons and images needed
         private JButton enter;
         private JButton edit;
         //private JButton report; //Will be used later
         private JLabel bluecar;          //Used with the ImageIcon to create CRV image
         private JPanel carimage;     //Used in buildImagePanel method
         private JPanel datum;          //Used in buildDatumPanel method
         private JPanel gasgrade;     //Used in buildGasTypePanel method.
         //Declaring the Panels that need to be built and added
         //to the border layout of this panel.
         //private JPanel panlimages;
         //private JPanel panltextinputs;
         //private JPanel panlchkBoxes;
         // Class to handle functionality of checkboxes
         ItemListener handler = new CheckBoxHandler();
         // This is where you add the constructor for the class - I THINK!!
         public CollectTextInput()
         { // Opens collectTextInput constructor
              // Must set layout for collectTextInput here
              // Choosing a BorderLayout because we simply want to
              // add panels to the North, Center and South borders, which, by
              // default, will fill the layout with the three panels
              // we are creating
              setLayout(new BorderLayout());
              //Initialize the objects in the constructor of the class.
              //Initialize the textfields
              currentMileage = new JTextField();
              numofGallonsBought = new JTextField();
              dateofPurchase = new JTextField();
              pricePerGallon = new JTextField();
              gasBrand = new JTextField();
              // Initialize the labels that go with each TextField
              lblcurrentMileage = new JLabel("Enter the mileage at the time of gas purchase: ");
              lblnumofGallonsBought = new JLabel("Enter the number of gallons of gas bought: ");
              lbldateofPurchase = new JLabel("Enter the date of the purchase: ");
              lblpricePerGallon = new JLabel("Enter the price per gallon you paid for the gas: ");
              lblgasBrand = new JLabel("Enter the brand name of the gas: ");
              //Initialize the labels for the checkboxes.
              chbxReg = new JCheckBox("Regular ", true);
              chbxSuper = new JCheckBox("Super ");
              chbxUltra = new JCheckBox("Ultra ");
              chbxOther = new JCheckBox("Other: (Choose one from below) ");
              chbxHigher = new JCheckBox("Higher than Ultra ");
              chbxLower = new JCheckBox("Lower than Ultra ");
              //Initialize the buttons that go on the panel.
              enter = new JButton("Save Data");
              edit = new JButton("Edit Data");
              //Initialize the image that oges on the panel.
              bluecar = new JLabel("2002 Honda CR-V", new ImageIcon("CRVBlue.jpg"),JLabel.CENTER);
              // Now bring it all together by calling the other methods
              // that build the other panels and menu.
              buildImagePanel();
              buildDatumPanel();
              buildGasTypePanel();
              // Once the methods above build the panels, this call to add
              //  them will add the panels to the main panel's border
              // layout manager.
              add(datum, BorderLayout.NORTH);
              add(carimage, BorderLayout.EAST);
              add(gasgrade, BorderLayout.CENTER);
         } // Ends the constructor.
            // This method creates a panel called images that holds the car image.
         public void buildImagePanel();
         { // Opens buildImagePanel.
              // First, create the Panel
              carimage = new JPanel();
              //Second, set the color and layout.
              carimage.setBackground(Color.white);
              carimage.setLayout(new FlowLayout());
              // Third, add the image to the panel.
              carimage.add(bluecar);
         }// Closes buildImagePanel
         //This method creates a panel called datum that holds the text input.
         public void buildDatumPanel();
         { //Opens buildDatumPanel
              // First, create the Panel.
              datum = new JPanel();
              //Second, set the background color and layout.
              datum.setBackground(Color.white);
              datum.setLayout(new GridLayout(2, 4, 20, 20));
              //Third, add the textfields and text labels to the panel.
              datum.add(lblcurrentMileage);
              datum.add(currentMileage);
              datum.add(lblnumofGallonsBought);
              datum.add(numofGallonsBought);
              datum.add(lbldateofPurchase);
              datum.add(dateofPurchase);
              datum.add(lblpricePerGallon);
              datum.add(pricePerGallon);
              datum.add(lblgasBrand);
              datum.add(gasBrand);
              //Optionally - Fourth -set a border around the panel, including
              // a title.
              datum.setBorder(BorderFactory.createTitledBorder("Per Purchase Information"));
              //Fifth - Add listeners to each text field to be able to
              //  know when data is input into them.
              currentMileage.addActionListener(this);
              numofGallonsBought.addActionListener(this);
              dateofPurchase.addActionListener(this);
              pricePerGallon.addActionListener(this);
              gasBrand.addActionListener(this);
         }// Closes buildDatumPanel
         // This method builds a panel called gasTypePanel that holds the checkboxes.
         public void buildGasTypePanel()
         { // Opens buildGasTypePanel method
              // First, create the panel.
              gasgrade = new JPanel();
              // Second, set its background color and its layout.
              gasgrade.setBackground(Color.white);
              gasgrade.setLayout(new GridLayout(5, 1, 10, 20));
              // Third, add all the checkboxes to the panel.
              gasgrade.add(chbxReg);
              gasgrade.add(chbxSuper);
              gasgrade.add(chbxUltra);
              gasgrade.add(chbxOther);
              gasgrade.add(chbxHigher);
              gasgrade.add(chbxLower);
              //Optionally, - Fourth - set a border around the panel, including
              // a title.
              gasgrade.setBorder(BorderFactory.createTitledBorder("Gas Type Information"));
              // Fifth - CheckBoxes require a CheckBox Handler.
              // This is a method created separately
              // outside of the method where the checkboxes are added to
              // the panel or where the checkboxes are even created.
              // This method (CheckBox Handler) implements and ItemListener
              // and is a self-contained method all on its own. See
              // the CheckBox Handler methods following the
              // actionPerformed method which follows.-SLM
         } // Closes the buildGasTypePanel method
    // Create the functionality to capture and react to an event
    //   for the checkboxes when they are checked by the user and
    //   the text fields to know when text is entered. Also to react to the
    //   Enter button being pushed and the edit button being pushed.
    public void actionPerformed(ActionEvent evt)
    { // Opens actionPerformed method.
         if((evt.getSource() == currentMileage) || (evt.getSource() == enter))
              { // Opens if statement.
                // Retrieves the text from the currentMileage text field
                //  and assigns it to the variable currentMileageText of
                //  type String.
                String currentMileageText = currentMileage.getText();
                lblcurrentMileage.setText("Current Mileage is:    " + currentMileageText);
                // After printing text to JLabel, hide the text field.
                currentMileage.setVisible(false);
           } // Ends if statement.
          if((evt.getSource() == numofGallonsBought) || (evt.getSource() == enter))
              { // Opens if statement.
                // Retrieves the text from the numofGallonsBought text field
                //  and assigns it to the variable numofGallonsBoughtText of
                //  type String.
                String numofGallonsBoughtText = numofGallonsBought.getText();
                lblnumofGallonsBought.setText("The number of gallons of gas bought is:    " + numofGallonsBoughtText);
                // After printing text to JLabel, hide the text field.
                numofGallonsBought.setVisible(false);
           } // Ends if statement.
           if((evt.getSource() == dateofPurchase) || (evt.getSource() == enter))
                     { // Opens if statement.
                       // Retrieves the text from the dateofPurchase text field
                       //  and assigns it to the variable dateofPurchaseText of
                       //  type String.
                       String dateofPurchaseText = dateofPurchase.getText();
                       lbldateofPurchase.setText("The date of this purchase is:    " + dateofPurchaseText);
                       // After printing text to JLabel, hide the text field.
                       dateofPurchase.setVisible(false);
           } // Ends if statement.
           if((evt.getSource() == pricePerGallon) || (evt.getSource() == enter))
                            { // Opens if statement.
                              // Retrieves the text from the pricePerGallon text field
                              //  and assigns it to the variable pricePerGallonText of
                              //  type String.
                              String pricePerGallonText = pricePerGallon.getText();
                              lblpricePerGallon.setText("The price per gallon of gas for this purchase is:    " + pricePerGallonText);
                              // After printing text to JLabel, hide the text field.
                              pricePerGallon.setVisible(false);
           } // Ends if statement.
           if((evt.getSource() == gasBrand) || (evt.getSource() == enter))
                       { // Opens if statement.
                         // Retrieves the text from the gasBrand text field
                         //  and assigns it to the variable gasBrandText of
                         //  type String.
                         String gasBrandText = gasBrand.getText();
                         lblgasBrand.setText("The Brand of gas for this purchase is:    " + gasBrandText);
                         // After printing text to JLabel, hide the text field.
                         gasBrand.setVisible(false);
           } // Ends if statement.
           // This provides control statements for the Edit button. If the
           //  Edit button is clicked, then the text fields are visible again.
           if(evt.getSource() == edit)
           { // Opens if statement.
             // If the edit button is pressed, the following are set to
             //  visible.
                currentMileage.setVisible(true);
                numofGallonsBought.setVisible(true);
                dateofPurchase.setVisible(true);
                pricePerGallon.setVisible(true);
                gasBrand.setVisible(true);
         }// Closes if statement.
    } // Closes actionPerformed method.
         private class CheckBoxHandler implements ItemListener
         { // Opens inner class
              public void itemStateChanged (ItemEvent e)
              {// Opens the itemStateChanged method.
                   JCheckBox source = (JCheckBox) e.getSource();
                        if(e.getStateChange() == ItemEvent.SELECTED)
                             source.setForeground(Color.blue);
                        else
                             source.setForeground(Color.black);
                        }// Closes the itemStateChanged method
                   }// Closes the CheckBoxHandler class.
    } //Ends the public class collectTextInput classThe error I keep receiving is as follows:
    C:\jdk131\CollectTextInput.java:128: missing method body, or declare abstract
         public void buildImagePanel();
    ^
    C:\jdk131\CollectTextInput.java:142: missing method body, or declare abstract
         public void buildDatumPanel();
    ^
    2 errors
    I have looked this error up in three different places but the solutions do not apply to what I am trying to accomplish.
    Any help would be greatly appreciated!! Thanks!
    Susan

    C:\jdk131\CollectTextInput.java:128: missing methodbody, or declare ?abstract
    public void buildImagePanel();^
    C:\jdk131\CollectTextInput.java:142: missing methodbody, or declare abstract
    public void buildDatumPanel();Just remove the semicolons.
    Geesh! If I had a hammer I would be hitting myself over the head with it right now!!! What an obviously DUMB newbie mistake!!!
    Thanks so much for not making me feel stupid! :-)
    Susan

  • Error message  "missing method body, or declare abstract"

    This is my test driver. Does anyone know why it is not working?
    public class TestInfo
       public static void main(String args[])
              Info results = new Info();
              printInfo();
         public static String printInfo();
              System.out.println(" The Diameter is: " + results.diam
              + " The Circumference is: " + results.circum
              + " The Area is: " + results.area);
    }The error message I get is: missing method body, or declare abstract
    The print block has to be a separate method. The print block works when I put it in main. When it is in a separate method and I call it in main it doesn't work

    You have an extraneous semi-colon after printInfo. This tells the compiler that that's all there is for that method, which only makes sense if it's an abstract method. It sees the block after the semicolon, but it thinks it's an initializer. So it wants you to either declare it abstract, or give it a method body.
    Just remove that semicolon and you're fine.

  • Missing method body or declare abstract...

    Hi There,
    Im working on an assignment that works with the math class and performs a bunch of mathematical functions. Im trying to declare the different fields in the math class and I keep getting error messages!!
    This is what I have right now
    public class Math
        // Returns the absolute value of a double value.
        double abs(double a);
        // Returns the absolute value of a int value.
        int abs(int a);
        //Returns the greater of two double values.
        double max(double a, double b);
        //Returns the greater of two int values.
        int max(int a, int b);
        // Returns the lesser of two double values.
        double min(double a, double b);
        // Returns the lesser of two double values.
        int min( int a, int b);
        // Returns the value of the first argument raised to the power of
        // the second argument.
        double pow(double a, double b);
        // Returns the remainder of division of two integers.
        int remainder(int a, int b);
        // Returns the closest long to the argument.
        long round(double a);
        // Returns the sum of all the elements in an array of doubles.
        double sum(double [] doubleArr);
        // Returns the sum of all the elements in an array of ints.
        int sum(int [] intArr);
        // Storage for the list of integers used for the int sum method.
        private int [] intArray = {5, 10, 15, 20};
        // Storage for the list of doubles to be used double sum method.
        private double [] doubleArray = {5.25, 10.00, 14.50, 21.90};
        }When I try and compile it tells me that Im missing method body or declare abstract.
    I originally had this
       // Returns the absolute value of a double value.
        double abs;
        // Returns the absolute value of a int value.
        int abs;
        //Returns the greater of two double values.
        double max;
        //Returns the greater of two int values.
        int max;
        // Returns the lesser of two double values.
        double min;
        // Returns the lesser of two double values.
        int min;
        // Returns the value of the first argument raised to the power of
        // the second argument.
        double pow;
        // Returns the remainder of division of two integers.
        int remainder;
        // Returns the closest long to the argument.
        long round;
        // Returns the sum of all the elements in an array of doubles.
        double sum(double [] doubleArr);
        // Returns the sum of all the elements in an array of ints.
        int sum(int [] intArr);
        // Storage for the list of integers used for the int sum method.
        private int [] intArray = {5, 10, 15, 20};
        // Storage for the list of doubles to be used double sum method.
        private double [] doubleArray = {5.25, 10.00, 14.50, 21.90};When i tried doing this it told me that I had already declared the field previously when it got the the field with the same name and thats why I added the bit in brackets.....
    Im so lost... can anybody hep????

    hi,
    here is your code...
    modified by correcting my bad habit...
    he..he...
    public class Math
        // Returns the absolute value of a double value.
        double abs(double a){return 0.0;}
        // Returns the absolute value of a int value.
        int abs(int a){return 0;}
        //Returns the greater of two double values.
        double max(double a, double b){return 0.0;}
        //Returns the greater of two int values.
        int max(int a, int b){return 0;}
        // Returns the lesser of two double values.
        double min(double a, double b){return 0.0;}
        // Returns the lesser of two double values.
        int min( int a, int b){return 0;}
        // Returns the value of the first argument raised to the power of
        // the second argument.
        double pow(double a, double b){return 0.0;}
        // Returns the remainder of division of two integers.
        int remainder(int a, int b){return 0;}
        // Returns the closest long to the argument.
        long round(double a){return 0.0;}
        // Returns the sum of all the elements in an array of doubles.
        double sum(double [] doubleArr){return 0.0;}
        // Returns the sum of all the elements in an array of ints.
        int sum(int [] intArr){return 0;}
        // Storage for the list of integers used for the int sum method.
        private int [] intArray = {5, 10, 15, 20};
        // Storage for the list of doubles to be used double sum method.
        private double [] doubleArray = {5.25, 10.00, 14.50, 21.90};
        }if you want to extend Math class to any other class.. then make all the methods abstract
    dhaval.
    Edited by: Dhaval.Yoganandi on 1 Mar, 2008 3:48 PM

  • How to use the method "getChildrenRemoved()" declared in ElementChange?

    How to use the method "getChildrenRemoved()" declared in DocumentEvent.ElementChange?

    I have tried to use it,but the code below alway say "Yes"....
    I really have no ideas about why ec is always a null.
    public void removeUpdate(DocumentEvent ee) {
           DocumentEvent.ElementChange ec = ee.getChange(doc.getDefaultRootElement());
           if(ec == null)
              System.out.println("Yes");
                     }

  • Why java does not force to declare atleast one abstract method

    hi,
    i can define an abstract class without declaring any abstract method in that class. But why wud i do this ? i mean when i have decided that a particular class should be inherited by other subclass and subclass should porvide implementation then there should be atleast one method in the abstract super class which requires implementation.
    All i want to know is why java does not force to declare atleast one abstract method in abstract class.
    there may be some situations where this restriction can create problem if it is like that then can anybody give some example.
    manish

    hi,
    i didn't get u.
    u r trying to say that i have an abstract class with
    only static methods then my questions is why wud
    declare such a class as 'abstract' class? because a
    static method can't be abstract also. Even then if
    somebody want to define such a class with only static
    methods then compiler should force him to declare
    atleast one abstract method which can be implemented
    by subclass, because as i said before if sumbody
    decide to define a class abstract then he wants that
    it should be inhereted but as u r saying a class with
    only static methods then it should not be an abstract
    class it can be a simple class.there's no functional reason, really... actually, factory-like classes are often defined the way Ceci described
    "abstract" only ensures that nobody can ever get an instance of that class (as a matter of fact, what would be the point of getting an instance, if no instance method exists ?)

  • How to find the abstract method?

    Hello all,
    I have a quick question.
    If there is an abstract class with few abstract methods in it, how can we know which one is abstract method in SE24 ?
    Is there any setting to display all the abstract methods in SE24?
    And, all the methods are getting displayed in SE24 in such a way that
    <Interface1>
         method1
         method2
    <Interface2>
         method1
         method2
    Is it possible to display only the methods without its interface name?
    Thank you.
    -Ezhno.

    Hi Ezhno,
    In methods tab of se24, select the method &
    Click on detail view icon i.e. 4th button after Parameter, Exception & code button, there you can see attributes of method , there is a checkbox for 'Abstract'.
    Thanks,
    Sharath

  • Is not abstract and does not override abstract method actionPerformed

    I dont how to corr. Please help!! and thank you very much!!
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class test extends JFrame implements ActionListener, ItemListener
              private CenterPanel centerPanel;
              private QuestionPanel questionPanel;
              private ButtonPanel buttonPanel;
              private ResponsePanel responsePanel;
              private JButton b1,b2,b3,b4,b5;               //Create five references to Jbutton instances
         private JTextField t1,t2,t3,t4,t5;          //Create five references to JTextField instances
              private JLabel label1;                    //Create one references to JLabel instances
              private JRadioButton q1,q2,q3;               //Create three references to JRadioButton instances
              private ButtonGroup radioGroup;               //Create one references to Button Group instances
              private int que1[] = new int[5];           //Create int[4] Array
              private int que2[] = new int[5];
              private int que3[] = new int[5];
              private String temp1, temp2, temp3, temp4, temp5, temp6, temp7, temp8, temp9, temp10,
                        temp11, temp12, temp13, temp14, temp15;
    public test (String header)
              super(header);
              Container container = getContentPane();
              label1 = new JLabel ("PLease click on your response to ");     
              q1 = new JRadioButton("I understand most of the content of this subject",true);
              add(q1);
              q2 = new JRadioButton("I see the relevance of the subject to my degree",false);
              add(q2);
              q3 = new JRadioButton("The workload in this subject is appropriate",false);
              add(q3);
              radioGroup = new ButtonGroup();               //JRadioButton belong to ButtonGroup
              radioGroup.add(q1);
              radioGroup.add(q2);
              radioGroup.add(q3);
              JPanel buttonPanel = new JPanel();
              JPanel responsePanel = new JPanel();
              JPanel questionPanel = new JPanel();
              JPanel centerPanel = new JPanel();
              b1 = new JButton ("Strongly DISAGREE");          //Instantiate JButton with text
              b1.addActionListener (this);               //Register JButtons to receive events
              b2 = new JButton ("DISAGREE");
              b2.addActionListener (this);
              b3 = new JButton ("Neither AGREE or DISAGREE");
              b3.addActionListener (this);
              b4 = new JButton ("AGREE");
              b4.addActionListener (this);
              b5 = new JButton ("Strongly AGREE");
              b5.addActionListener (this);
              buttonPanel.setLayout(new GridLayout(5,1));
              buttonPanel.add(b1);
              buttonPanel.add(b2);
              buttonPanel.add(b3);
              buttonPanel.add(b4);
              buttonPanel.add(b5);
              t1 = new JTextField ("0",3);               //JTextField contains empty string
              t2 = new JTextField ("0",3);
              t3 = new JTextField ("0",3);
              t4 = new JTextField ("0",3);
              t5 = new JTextField ("0",3);
              t1.setEditable( false );
              t2.setEditable( false );
              t3.setEditable( false );
              t4.setEditable( false );
              t5.setEditable( false );
              responsePanel.setLayout(new GridLayout(5,1));
              responsePanel.add(t1);
              responsePanel.add(t2);
              responsePanel.add(t3);
              responsePanel.add(t4);
              responsePanel.add(t5);
              questionPanel.setLayout(new GridLayout(4,1));
              questionPanel.add(label1);
              questionPanel.add(q1);
              questionPanel.add(q2);
              questionPanel.add(q3);
              centerPanel.add(buttonPanel,BorderLayout.CENTER);
              centerPanel.add(responsePanel,BorderLayout.EAST);
              container.add(centerPanel,BorderLayout.WEST);
              container.add(questionPanel,BorderLayout.NORTH);
              q1.addActionListener(
                   new ActionListener(){
              public void actionPerformed( ActionEvent e )          
    {                                        //actionPerformed of all registered listeners
              if (e.getSource() == b1) {
                   que1[0] = Integer.parseInt(t1.getText()) + 1;
                   String temp1 = String.valueOf(que1[0]);
              t1.setText(temp1);
              else if (e.getSource() == b2)     {
                   que1[1] = Integer.parseInt(t2.getText()) + 1;
                   String temp2 = String.valueOf(que1[1]);
              t2.setText(temp2);
              else if (e.getSource() == b3)     {
                   que1[2] = Integer.parseInt(t3.getText()) + 1;
                   String temp3 = String.valueOf(que1[2]);
              t3.setText(temp3);
              else if (e.getSource() == b4)     {
                   que1[3] = Integer.parseInt(t4.getText()) + 1;
                   String temp4 = String.valueOf(que1[3]);
              t4.setText(temp4);
              else if (e.getSource() == b5)     {
                   que1[4] = Integer.parseInt(t5.getText()) + 1;
                   String temp5 = String.valueOf(que1[4]);
              t5.setText(temp5);
    } //end action performed
              q2.addActionListener(
                   new ActionListener(){
              public void actionPerformed( ActionEvent e )          
    {                                        //actionPerformed of all registered listeners
              if (e.getSource() == b1) {
                   que2[0] = Integer.parseInt(t1.getText()) + 1;
                   String temp6 = String.valueOf(que2[0]);
              t1.setText(temp1);
              else if (e.getSource() == b2)     {
                   que2[1] = Integer.parseInt(t2.getText()) + 1;
                   String temp7 = String.valueOf(que2[1]);
              t2.setText(temp7);
              else if (e.getSource() == b3)     {
                   que2[2] = Integer.parseInt(t3.getText()) + 1;
                   String temp8 = String.valueOf(que2[2]);
              t3.setText(temp8);
              else if (e.getSource() == b4)     {
                   que2[3] = Integer.parseInt(t4.getText()) + 1;
                   String temp9 = String.valueOf(que2[3]);
              t4.setText(temp9);
              else if (e.getSource() == b5)     {
                   que2[4] = Integer.parseInt(t5.getText()) + 1;
                   String temp10 = String.valueOf(que2[4]);
              t5.setText(temp10);
    } //end action performed
              q3.addActionListener(
                   new ActionListener(){
              public void actionPerformed( ActionEvent e )          
    {                                        //actionPerformed of all registered listeners
              if (e.getSource() == b1) {
                   que3[0] = Integer.parseInt(t1.getText()) + 1;
                   String temp11 = String.valueOf(que3[0]);
              t1.setText(temp11);
              else if (e.getSource() == b2)     {
                   que3[1] = Integer.parseInt(t2.getText()) + 1;
                   String temp12 = String.valueOf(que3[1]);
              t2.setText(temp12);
              else if (e.getSource() == b3)     {
                   que3[2] = Integer.parseInt(t3.getText()) + 1;
                   String temp13 = String.valueOf(que3[2]);
              t3.setText(temp13);
              else if (e.getSource() == b4)     {
                   que3[3] = Integer.parseInt(t4.getText()) + 1;
                   String temp14 = String.valueOf(que3[3]);
              t4.setText(temp14);
              else if (e.getSource() == b5)     {
                   que3[4] = Integer.parseInt(t5.getText()) + 1;
                   String temp15 = String.valueOf(que3[4]);
              t5.setText(temp15);
    } //end action performed
    }//end constructor test
    public void itemStateChanged(ItemEvent item) {
    //int state = item.getStateChange();
    //if (q1 == item.SELECTED)
              public class ButtonPanel extends JPanel
                   public ButtonPanel()
              public class CenterPanel extends JPanel
                   public CenterPanel()
              public class QuestionPanel extends JPanel
                   public QuestionPanel()
              public class ResponsePanel extends JPanel
                   public ResponsePanel()
    public static void main(String [] args)
         test surveyFrame = new test("Student Survey") ;
         surveyFrame.setSize( 500,300 );
         surveyFrame.setVisible(true);
         surveyFrame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
         }//end main
    }//end class test

    is not abstract and does not override abstract method actionPerformed
    Oh, I see that the title of your post is an error message? Ok. Well, the test class is declared as implementing an ActionListener. That means the test class must have an actionPerformed() method. Your test class apparently does not.
    It does not appear that the test class needs to implement ActionListener. You are using annonymous classes as listeners.

  • ...is not abstract and does not override abstract method compare

    Why am I getting the above compile error when I am very clearly overriding abstract method compare (ditto abstract method compareTo)? Here is my code -- which was presented 1.5 code and I'm trying to retrofit to 1.4 -- followed by the complete compile time error. Thanks in advance for your help (even though I'm sure this is an easy question for you experts):
    import java.util.*;
       This program sorts a set of item by comparing
       their descriptions.
    public class TreeSetTest
       public static void main(String[] args)
          SortedSet parts = new TreeSet();
          parts.add(new Item("Toaster", 1234));
          parts.add(new Item("Widget", 4562));
          parts.add(new Item("Modem", 9912));
          System.out.println(parts);
          SortedSet sortByDescription = new TreeSet(new
             Comparator()
                public int compare(Item a, Item b)   // LINE CAUSING THE ERROR
                   String descrA = a.getDescription();
                   String descrB = b.getDescription();
                   return descrA.compareTo(descrB);
          sortByDescription.addAll(parts);
          System.out.println(sortByDescription);
       An item with a description and a part number.
    class Item implements Comparable     
          Constructs an item.
          @param aDescription the item's description
          @param aPartNumber the item's part number
       public Item(String aDescription, int aPartNumber)
          description = aDescription;
          partNumber = aPartNumber;
          Gets the description of this item.
          @return the description
       public String getDescription()
          return description;
       public String toString()
          return "[descripion=" + description
             + ", partNumber=" + partNumber + "]";
       public boolean equals(Object otherObject)
          if (this == otherObject) return true;
          if (otherObject == null) return false;
          if (getClass() != otherObject.getClass()) return false;
          Item other = (Item) otherObject;
          return description.equals(other.description)
             && partNumber == other.partNumber;
       public int hashCode()
          return 13 * description.hashCode() + 17 * partNumber;
       public int compareTo(Item other)   // OTHER LINE CAUSING THE ERROR
          return partNumber - other.partNumber;
       private String description;
       private int partNumber;
    }Compiler error:
    TreeSetTest.java:25: <anonymous TreeSetTest$1> is not abstract and does not over
    ride abstract method compare(java.lang.Object,java.lang.Object) in java.util.Com
    parator
                public int compare(Item a, Item b)
                           ^
    TreeSetTest.java:41: Item is not abstract and does not override abstract method
    compareTo(java.lang.Object) in java.lang.Comparable
    class Item implements Comparable
    ^
    2 errors

    According to the book I'm reading, if you merely take
    out the generic from the code, it should compile and
    run in v1.4 (assuming, of course, that the class
    exists in 1.4). I don't know what book you are reading but that's certainly incorrect or incomplete at least. I've manually retrofitted code to 1.4, and you'll be inserting casts as well as replacing type references with Object (or the erased type, to be more precise).
    These interfaces do exist in 1.4, and
    without the generics.Exactly. Which means compareTo takes an Object, and you should change your overriding method accordingly.
    But this raises a new question: how does my 1.4
    compiler know anything about generics? It doesn't and it can't. As the compiler is telling you, those interfaces expect Object. Think about it, you want to implement one interface which declares a method argument type of Object, in several classes, each with a different type. Obviously all of those are not valid overrides.

  • "Abstract" method in a non-abstract class

    Hi all.
    I have a class "SuperClass" from which other class are extended...
    I'd like to "force" some methods (method1(), method2, ...) to be implemented in the inherited classes.
    I know I can accomplish this just implementing the superclass method body in order to throw an exception when it's directly called:
    void method1(){
    throw new UnsupportedOperationException();
    }...but I was wondering if there's another (better) way...
    It's like I would like to declare some abstract methods in a non-abstract class...
    Any ideas?

    The superclass just models the information held by
    the subclasses.
    The information is taken from the database, by
    accessing the proper table (one for each subclass).??
    What do you mean by "models the information"?
    You should use inheritance (of implementation) only when the class satisfies the following criteria:
    1) "Is a special kind of," not "is a role played by a";
    2) Never needs to transmute to be an object in some other class;
    3) Extends rather than overrides or nullifies superclass;
    4) Does not subclass what is merely a utility class (useful functionality you'd like to reuse); and
    5) Within PD: expresses special kinds of roles, transactions, or things.
    Why are you trying to force these mystery methodsfrom the superclass?
    It's not mandatory for me to do it... I 'd see it
    just like a further way to check that the subclasses
    implements these methods, as they have to do.That's not a good idea. If the superclass has no relation to the database, it shouldn't contain methods (abstract or otherwise) related to database transactions.
    The subclasses are the classes that handle db
    transaction.
    They are designed as a binding to a db table.And how is the superclass designed to handle db transactions? My guess (based on your description) is that it isn't. That should tell you right away that the subclasses should not extend your superclass.

  • Abstract method which when implemented will have different parameters

    Hello to all,
    I have an assignment but not looking for someone to do it for me. I am only searching for a suggestion on how to do the following.
    Imagine having an application that needs to provide an estimate of the rent for different buildings.
    Basically I start with by having a class name Building. This class has an abstract method called estimateRent.
    I then create two classes that extend the class Building which are named Apartment and House. Both need to have the method estimateRent.
    However the problem is that the rent for the Apartment is calculated on the nights passed in the flat and the people in it, while the rent for the House is just calculated on a month bases.
    This means the estimateRent method requires to have different parameters depending if it is implemented inside the Apartment class or the House class.
    Now I only know of two options.
    The first option is to not declare the estimateRent method as an abstract method inside the Building class and just implemented inside the Apartment and House with different parameters. I do not like this option since in the future if a new Building comes in then I would like to impose the fact that that object needs to have a calculate method.
    The second option is to make the estimateRent method as abstract inside the Building class however takes a parameter of either a String array or else a Map. Then the estimateRent within the Apartment class would search for the elements tagged as nights and people, and the House class would only search for the elements tagged as months!
    However do not know if there are any other, better ways on how to do this. I am using Java 1.4 however if you only have answers for Java 5.0 then please post them again since I always like to learn something new :)
    Thank You for any comments.
    tx

    The implementation changes, yes.Yes that I could understand in the Strategy Pattern (in the document I read it was being compared with the Template Pattern).
    Then you need to refactor your design.I tought about that, however if you read my first post you will notice that I have different criteria on which the costs need to be estimated. While the costs for a flat are estimated on the people staying in and nights slept there, the costs for the house are based only on the months stayed there regardless of the people living in. Now for me I feel that it is bad programming practice to create one method that can have all the parameters required for any scenario. I mean the following is NOT something I am going to do:
    estimateCosts(int nights, int people, int months ... etc);
    That's not a very elegant way of going about it.
    What is the "Context" going to have?Yep I agree, but so far my limited brain has only come up with that! I am open to any other sugestion! always if i understand it first!
    Basically the Context would better be named as Criteria and it would be an interface as follows:
    interface Criteria{}
    Then I would create two classes that implement the Criteria object as follows:
    class AppartmentCriteria implements Criteria{
    public Result estimateCosts(int nights, int people);
    class HouseCriteria implements Criteria{
    public Result estimateCosts(int months);
    Now when I recieve the inputs, depending on the scenario the Criteria is typecasted and the correct parameters passed and we recieve the Result.
    I feel the above sucks since I am not seeing it as an object oriented way of doing this out! Is there any other sugestions! The refactoring thing I am intrested in! however really I can not see how such a call to that method could be refectored!
    Thank You,
    tx.
    PS: Sun has blocked my other account as well, and this time they did not even send me an email to confirm that I was registered successfuully :( Is there someone I can contact on this? I guess next time I will reply with tx53m :)

Maybe you are looking for

  • Image Metadata

    Hello, I am writing a BufferedImage to disk in png format and I would like to have a text representation saved as metadata. I would like to work without third party libraries if possible. Can someone point me in the right direction? I am currently us

  • Nokia Suite 3.2 SIM contact storage and account lo...

    Hi, In order to backup onto my laptop, synch'd contacts using Nokia 3.2.100. Found that while contacts on memory card were synched successfully, SIM contacts weren't. Is this a known issue with this version of Suite. Know that earlier Nokia PC Suite

  • Bridge defaults set to launch 32 bit Photoshop CS4 - why?

    I'm setting up a new Vista Ultimate 64 bit machine with Photoshop CS4. I am most familiar with CS2 on a Windows XP computer. I've read some posts about setting Bridge to launch 64 bit rather than 32 bit CS4 Photoshop. I've checked the file associatio

  • Why are my imported stills turning black?

    Trying to create a slideshow in iMovie HD 6.0.3. However, every jpg file I import. loads, then turns black (completely black) in iMovie. Why is this? Your help is greatly appreciated!

  • Essbase Drilldown limits

    Hi there, we are currently on version 11.1.1.2. After adjusting my config file I am able to drilldown 500,000 lines but no more. Does the new version of essbase 11.1.2 - increase this limit? We use the Excel Add-in thanks