Use methods in other classes

Can I use methods from other classes than the class that myClass extends?
ex. myClass extends parentClass{
myMethod()
myMethod() is declared in i third class. Is this possible or can I only use classes from the parent class?
-Thanks-

I'm not really sure what the previous two answers were getting at.
Yes, you can use methods all the way up the class hierarchy, as long as they are visible.
For example, Object implements toString(). You can call toString() on any object in Java and it will render the object to a string in one way or another. That is because toString() is public.
If toString() were protected, you would only be able to call the method if you were a subclass of of that object (or in the same package), which would make the toString() method much less useful.
I would suggest reading up on the differences in the four visibility modifiers (private, (default), protected, and public). Private is the only one which nothing else can call. If you are public or protected, any subclass can call the method, even if there are 20 superclasses between the implementor and the caller.
Good luck!
Steve

Similar Messages

  • Use methods of another class

    Dear Sir/madam,
    i have a question about using methods of another class. I will explane:
    i have made a class which is called A. This class has some attributes (studentName and examRank) and some methods.
    Now i need to made another class called B. Now i want to make an array where i can add some attributes of objects which i made of class A. How can i do that?
    Kind regards

    Here's a for-instance that doesn't use your exact program but demonstrates the point:
    public class A
      int value;
      String name;
      public A(int value, String name)
        this.name = name;
        this.value = value;
      public int getValue()
        return value;
      public String getName()
        return name;
      public String toString()
        return name + ": " + value;
    import java.util.Arrays;
    import java.util.Random;
    public class B
      private static final String[] NAMES =
        "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
      private static final int MAX = 100;
      private A[] myAs = new A[NAMES.length];
      private Random random = new Random();
      public B()
        for (int i = 0; i < myAs.length; i++)
          myAs[i] = new A(random.nextInt(MAX), NAMES);
    public String toString()
    return Arrays.toString(myAs);
    public int getTotal()
    int temp = 0;
    for (int i = 0; i < myAs.length; i++)
    temp += myAs[i].getValue();
    return temp;
    public static void main(String[] args)
    B b = new B();
    System.out.println(b);
    System.out.println("Total: " + b.getTotal());

  • Error in using method get_event of class cl_htmlb_manager.

    Hi All,
    i am trying to get the event details in a particular method as follows;
    data: event type ref to cl_htmlb_event .
    event = cl_htmlb_manager=>get_event( runtime->              server-  >request ).
    i am getting an error
    field RUNTIME is unknown , it is neither in one of the specified tables nor defined by DATA statement. DATA statement. DATA statement.
    Where am i going wrong?
    plz help.
    BR,
    Annu.

    Hi Jorge,
    I am trying to use it in the method GET_LIST of class CL_SUS_M_ORDER_LIST .
    If i use
    event = cl_htmlb_manager=>get_event_ex( request ).
    again i get the error  Field REQUEST is unknown .
    and if i dont declare event using data statement
    data: event type ref to cl_htmlb_event .
    then i get the error that Field EVENT is unknown.
    My application is MVC pattern.
    So is there anyother way of geting the EVENT details when RUNTIME / REQUEST are not available ?
    Thaknks for the reply.

  • How to pass entire class as a parameter in a method of other class- OpenScr

    Hi Folks,
    Whenever we create a script in OpenScript, it can contain only one class. However I want to declare several variables in a class/script and pass this entire class B as a parameter in a methodA of classA.
    What I mean by mean that is , I create ClassB something like below
    public class MyParams.....
    variable1;
    variable2;
    variable3;
    variable4;
    variable5;
    public class Original.....
    public void methodA(MyParams params)
    params = new MyParams();
    field1 = params.variable1;
    field2 = params.variable2;
    field3 = params.variable3;
    field5= params.variable5;
    Edited by: OATS Explorer on Mar 8, 2012 1:53 AM

    Hi
    I have a stand alone program (can be used by all other users) which will accept request_id and To_Email as parameters. I am developing a new request set in which I want to incldue this stand alone program and want to pass Prog#1 request Id to the 2nd stand alone program as a parameter so that I can send the output of the Prog#1 to the users through E-mail.
    Do we have any options to pass Prog#1 requeset id in to Prog#2 as a parameter in the request set without modifying the stand alone concurrent program code.
    Please note that i dont want to change stand alone program code becuase this code/program was developed to work in general for all the users and I dont want to change this code for new requirement/purpose...
    Hope you understood my requirement...
    Thanks!!

  • Transaction code which using method of a class as start object

    Hi all,
    I'm creating a new tcode 'Z123' which is tied to a method of a class in SE93. However, when I run this tcode and into debug mode, SY-TCODE will always return OS_APPLICATION. How can I get the actual tcode, which is 'Z123' into my program?
    Thanks in advance

    You can try using the method GET_CURRENT_TRANSACTION of class CL_DYNPRO. Check this SAP documentation for details:
    ... the method GET_CURRENT_TRANSACTION of the class CL_DYNPRO can be used to obtain the transaction code of the current transaction. This method returns the transaction code during a parameter transaction or variant transaction instead of the transaction code of the implicitly called dialog transaction.
    But if i try checking sy-tcode in a tcode bound to a method of a class i get the correct tcode & not OS_APPLICATION.
    Br,
    Suhas

  • Use method from father class for event

    Hi,
    I want to use a preDelete event in my class, but the method I would like to call for the event is not in the class itself, but in the (abstract) predecessor class. Any chance to do this? At the moment I can't select the method in the event tab page (it's not in the list to choose from ...)
    Thank you!
    J.F.

    In 9.0.4 you will need to add the parent class as a descriptor and choose to deactivate it. This will allow you to choose methods from that class in the subclass descriptors.
    In 10.1.3 there is a dialog for specifying classes that are not persistent, but necessary in other persistent classes: http://www.oracle.com/technology/products/ias/toplink/doc/1013/main/_html/mw007.htm#sthref629
    A good explanation of why we don't store the parent and referenced classes unless explictly asked can be found here: Re: Mapping Workbench  10.1.3.0 Bug - Cannot add Implemented Interfaces
    Hope this helps,
    Karen

  • How to use method of Standard Class

    Hi all,
                  I want to call a pop up in pcui screen in some standard application with some text. I have made Zclass of  standard SAP class which i am using (cl_bsp_accmod_contact in CRM system).
    I think i have to call 'PRINT_STRING' method of  standard class CL_BSP_ELEMENT.
    <i>I am trying to use this code: </i>
    <b>
    data: lr_data type ref to cl_bsp_element.
      concatenate html 'rohit' into html.  (html is a string)
      lr_data->print_string( html ).</b>
    <u>but it gives a dump:</u>
    You attempted to use a 'NULL' object reference (points to 'noth
    access a component (variable: "lr_data").
    An object reference must point to an object (an instance of a class)
    before it can be used to access components.
    I dont know how to assign object reference to an object???
    Plz help me in this regard,
    Thanks in advance,
    Rohit

    Hi ,
    try and use :
    data: lr_data type ref to cl_bsp_element.
    concatenate html 'rohit' into html. (html is a string)
    lr_data->print_string( html = html ).
    You are creating a variable...but not passing the value to the parameter...it is exactly like callin get_data or get_cell_value...!!
    Hope this helps.
    <i><b>Do reward each useful answer.</b></i>
    Thanks,
    Tatvagna.

  • Calling a Method in other Class

    I want to call a method in another class when an action is preformed can anyone suggest how I might do this??
         addSquare.addActionListener(new ActionListener()
                   public void actionPerformed(ActionEvent e)
         

    I want to call a method in another class when an
    action is preformed can anyone suggest how I might do
    this??
            addSquare.addActionListener(new ActionListener()
                 public void actionPerformed(ActionEvent e)
                 {               OtherClass oc = //getrefererncetootherclass
                   oc.methodtocall(params, to, pass);

  • JFrame not showing components when called method in other class

    Hi everyone,
    I am new to SWING,and have this little problem.
    i have created a JFrame which has a button and its calling a method in another class.the result takes much more time(around 3mins) as the call involved with FTP.
    My problem is , i click the button(other componetns also there),and waiting for the result.all the time my Frame doesnt show any of the components,it looks as if the components are added to it.but when the call returns.everything is OK.
    Can any1 help me?
    Thanx in advance
    ethirajan

    http://java.sun.com/docs/books/tutorial/essential/threads/
    http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html
    http://java.sun.com/products/jfc/tsc/articles/threads/threads1.html

  • Calling methods from other classes

    I have a bunch of little java files in a folder, do I need to make a package in order to access all the methods in all the classes, or can I just make an instance of any of the methods because all the classes are in the same folder?

    HI,
    If your methods have a "public" modifier (and the class does too) then you can instantiate your classes as objects from that (so-called) "default" package in any other class or object in any other package and then call the methods on those instantiated objects as you please.
    If that sounds confusing... I'd seriously try the excellent tutorials at this site, especially "the java tutorial".
    /k1

  • How to use method of one class in other class.

    Hi.I am new to object orient approach .I am developing a project which has a class as application .My class has it state control as another class which is notification class.I want to use my notification class method (init)in my application class method .i have also used read and write accessors vis.But i have broken lines in my code.Please help me correct it. and print screen is attached below.
    Attachments:
    Application.docx ‏143 KB

    On the left, you have wired 2 sources on the same tunnel/wire, so that's 1 broken wire.
    In the For loop, you are trying to wire a "Red" object from the first subVI to the input of the "Green" subVI, so a "Green" object. If Red is not a descendant class of Green (or share a common ancestor), it is not permitted.
    FInally, the output of the For loop, is a 1D array of "Green" objects, which is probably not the same data type as the input of the last subVI on the right (it's probably a "Green" object scalar).
    Overall, you can use the "List Errors" dialog box (Ctrl+L) to debug your code, and make exhaustive use of the contextual help (Ctrl+H) to see what is going on when focusing a broken wire.
    Regards
    Eric M. - Application Engineering Specialist
    Certified LabVIEW Architect
    Certified LabWindows™/CVI Developer

  • Help required: Using objects/methods in other classes

    Hi
    Say you have a class that has a private string instance variable and you have a accessor and mutator method for this object in that class.
    You have another class that needs to access this object via the accessor and mutator methods. How do you do this? When I try I only get nullPointerExceptions or Stack Overflows!!! If anyone can provide some code on how to do this successfully then that will be most appreciated. Thanks.

    Kayaman gave you the right answer
    public class MyDataClass {
    private String importantString;
    public void setImpString(String s) {
    importantString = s;
    public String getImpString() {
    return importantString;
    public class MyMainClass {
    public static void main(String[] args) {
    MyDataClass a = new MyDataClass();
    a.setImpString("This is important");
    System.out.println(a.getImpString());
    }Note that he sets the value of the imp string before trying to get it. The nullpointer that you say is probably because you dont do that.
    Also When you aks a question a little humility doesnt hurt.
    You do need a tutorial first.

  • Explizit using methods of base class

    when using a base class reference from an abstract class A and creating an object of subclass B
    A ref_A = new B();
    assuming we have implemented the method m() in A and B, then
    ref_a.m()
    calls Method m of subclass B
    (dynamic binding, fine)
    Is there a possibility to force explicitely the call of method m of superclass A.
    (i mean not a call from Method m in B with super())

    are you absolutely sure ?I am sure. Perhaps you are thinking of C++ (and if you're not, I am!) where you can write: ref_A.A::m(),
    but there's no way from the client code to do that in Java. If you really need to do this, your
    design of A should reflect it:
    public abstract class A {
        public final void mOldSchool() {...}
        public void m() { mOldSchool(); }
    public class B extends A {
        public void m() {...}
    }I agree with Kayaman, though: question your design. In the abstract, this is a shakey design.

  • Acessing Methods From Other Class....

    Hi,
    Im creating a Estate Agent system for a project.
    Basically I have 4 class..
    Customer.class
    AddCustomer.class
    Buyer.class
    Seller.class
    The Customer class is used to create an instance of a customer in order to do things with this information latter on by passing values to it from the AddCustomer.class where the user inputs this information . The AddCustomer adds information to the database that the user has inputted.
    What i want to do with the Buyer and Seller class though is access this customer information that has been passed from AddCustomer to the Customer class... Im Just To Sure How...

    Nope....
    Im trying to access the created customer instance information that I created from within AddCustomer from Buyer And Seller in order to use that information...
          package estateAgent;
        import info.clearthought.layout.TableLayout;
        import java.awt.BorderLayout;
        import java.awt.FlowLayout;
        import java.awt.Font;
        import java.awt.event.ActionEvent;
        import java.awt.event.ActionListener;
        import java.sql.Connection;
        import java.sql.PreparedStatement;
        import java.sql.ResultSet;
        import java.sql.SQLException;
        import javax.swing.JButton;
        import javax.swing.JComboBox;
        import javax.swing.JFormattedTextField;
        import javax.swing.JLabel;
        import javax.swing.JOptionPane;
        import javax.swing.JPanel;
    import javax.swing.JTextField;
         * @author scs5kjb
         * @author Christopher James Cartlidge
         * @author SI
         * @version 1.5
        public class AddCustomer extends Screen
          private GUI gui;
          private JButton buyerButton;
          private JButton sellerButton;
          private JButton cancelButton;
          private JPanel buttonPanel;
          private JComboBox title;
          private JTextField firstName;
          private JTextField surname;
          private JTextField address1;
          private JTextField address2;
          private JTextField address3;
          private JTextField county;
          private JFormattedTextField postcode;
          private JTextField phoneNumber1;
          private JTextField phoneNumber2;
          private JPanel textPanel;
          private String customerID = "";
         private PreparedStatement addCustomerQuery;
         private PreparedStatement getCustomerIDQuery;  
           * Creates an AddCustomer.
           * @param gui The GUI object that displays the screen
          public AddCustomer( GUI gui, Connection database )
            this.gui = gui;
            String message = "Fields marked with a * need to be filled in";
            addHelp( null, message );
            createButtons();
            arrangeButtons();
            configureButtons(database);
            createFields();
            arrangeFields();
            addMainComponent( textPanel );
           * Initialises the buttons to go on the screen
          @Override public void createButtons()
            buyerButton = new JButton( "Buyer" );
            sellerButton = new JButton( "Seller" );
            cancelButton = new JButton( "Cancel" );
           * Initialises the text fields to go on the screen
          @Override public void createFields()
            Font fieldFont = new Font( "Sans", Font.PLAIN, 14 );
            String[] titles = { "Mr", "Mrs", "Ms", "Dr" };
            title = new JComboBox( titles );
            firstName = new JTextField( 15 );
            firstName.setFont( fieldFont );
            surname = new JTextField( 15 );
            surname.setFont( fieldFont );
            address1 = new JTextField( 15 );
            address1.setFont( fieldFont );
            address2 = new JTextField( 15 );
            address2.setFont( fieldFont );
            address3 = new JTextField( 15 );
            address3.setFont( fieldFont );
            county = new JTextField( 15 );
            county.setFont( fieldFont );
            postcode = new JFormattedTextField( );
            postcode.setFont( fieldFont );
            phoneNumber1 = new JTextField( 15 );
            phoneNumber1.setFont( fieldFont );
            phoneNumber2 = new JTextField( 15 );
            phoneNumber2.setFont( fieldFont );
           * Positions the buttons on the screen
          @Override public void arrangeButtons()
            buttonPanel = new JPanel( new FlowLayout() );
            buttonPanel.add( buyerButton );
            buttonPanel.add( sellerButton );
            buttonPanel.add( cancelButton );
            add( buttonPanel, BorderLayout.SOUTH );
           * Positions the text fields on the screen
          @Override public void arrangeFields()
            double p = TableLayout.PREFERRED;
            // double f = TableLayout.FILL; - commented out as this is never read
            double b = 10; //border size
            double g = 10; //gap size
            double[][] size = {
                { b, p, g, p, g, b },
                { b, p, g, p, g, p, g, p, g, p, g, p, g, p, g, p, g,
                  p, g, p, g, b }
            textPanel = new JPanel( new TableLayout( size ) );
            textPanel.add( new JLabel( "Title:" ), "1, 1" );
            textPanel.add( title, "3, 1" );
            textPanel.add( new JLabel( "First Name:*" ), "1, 3" );
            textPanel.add( firstName, "3, 3" );
            textPanel.add( new JLabel( "Surname:*" ), "1, 5" );
            textPanel.add( surname, "3, 5" );
            textPanel.add( new JLabel( "Address 1:*" ), "1, 7");
            textPanel.add( address1, "3, 7");
            textPanel.add( new JLabel( "Address 2:" ), "1, 9");
            textPanel.add( address2, "3, 9");
            textPanel.add( new JLabel( "Town/City:" ), "1, 11");
            textPanel.add( address3, "3, 11");
            textPanel.add( new JLabel( "County:" ), "1, 13");
            textPanel.add( county, "3, 13");
            textPanel.add( new JLabel( "Postcode:*" ), "1, 15");
            textPanel.add( postcode, "3, 15");
            textPanel.add( new JLabel( "Telephone 1:*" ), "1, 17");
            textPanel.add( phoneNumber1, "3, 17");
            textPanel.add( new JLabel( "Telephone 2:" ), "1, 19");
            textPanel.add( phoneNumber2, "3, 19");
           * Configures the actions to be taken when one of the buttons on the
           * screen is pressed
          public void configureButtons(final Connection database)
            setBuyerButtonHandler(
                new ActionListener()
                  public void actionPerformed(ActionEvent e)
                    if( validateFields() ) {
                      try {
                       findNextCustomerID(database);
                       addNewCustomer(database);
                      catch (SQLException error) {
                        error.printStackTrace();
                      gui.select( "Add Buyer" );
                      clear();
            setSellerButtonHandler(
                    new ActionListener()
                      public void actionPerformed(ActionEvent e)
                        if( validateFields() ) {
                          try {
                            addNewCustomer(database);
                          catch (SQLException error) {
                            error.printStackTrace();
                          clear();
            setCancelButtonHandler(
                new ActionListener()
                  public void actionPerformed(ActionEvent e)
                    clear();
           * Deals with button clicks on the buyerButton
           * @param listener The action listener to deal with button presses
          private void setBuyerButtonHandler(ActionListener listener)
            buyerButton.addActionListener( listener );
           * Deals with button clicks on the buyerButton
           * @param listener The action listener to deal with button presses
          private void setSellerButtonHandler(ActionListener listener)
            sellerButton.addActionListener( listener );
           * Sets the action listener for the cancel button on the screen
           * @param listener The action listener to be added
          private void setCancelButtonHandler( ActionListener listener )
            cancelButton.addActionListener( listener );
           * Checks whether the information entered is valid
           * @return true if the information entered is valid
          public boolean validateFields()
            String message = "";
            boolean valid = true;
            if( ! Validation.validString( firstName.getText() ) ) {
              message += "Invalid first name. This field may only contain" +
                  " alphabetic characters\nand no white space";
              valid = false;
            if( ! Validation.validString( surname.getText() ) ) {
              if( ! message.equals( "" ) )
                message += "\n\n";
              message += "Invalid last name. This field may only contain" +
                  " alphabetic characters\nand no white space";
              valid = false;
            if( ! Validation.validAddress1( address1.getText() ) ) {
              if( ! message.equals( "" ) )
                message += "\n\n";
              message += "Invalid address 1. This field must have the house" +
                  " number as the first\ncharacters followed by alphabetic" +
                  " characters only";
              valid = false;
            if( ! address2.getText().equals( "" ) ) {
              if( ! Validation.validSentence( address2.getText() ) ) {
                if( ! message.equals( "" ) )
                  message += "\n\n";
                message += "Invalid address 2. This field may contain alphabetic" +
                    " characters only";
                valid = false;
            if( ! address3.getText().equals( "" ) ) {
              if( ! Validation.validSentence( address3.getText() ) ) {
                if( ! message.equals( "" ) )
                  message += "\n\n";
                message += "Invalid address 3. This field may contain alphabetic" +
                    " characters only";
                valid = false;
            if( ! county.getText().equals( "" ) ) {
              if( ! Validation.validSentence( county.getText() ) ) {
                if( ! message.equals( "" ) )
                  message += "\n\n";
                message += "Invalid county. This field may contain alphabetic" +
                    " characters only";
                valid = false;
            if( ! Validation.validPostcode( postcode.getText() ) ) {
              if( ! message.equals( "" ) )
                message += "\n\n";
              message += "Invalid postcode. The postcode must be in the format:\n" +
                  "L(L)N(N) NLL\nWhere 'L' is a letter, 'N' is a number and " +
                  "values in brackets\nare optional";
              valid = false;
            if( ! Validation.validPhone( phoneNumber1.getText() ) ) {
              if( ! message.equals( "" ) )
                message += "\n\n";
              message += "Invalid primary phone number. This field may contain" +
                  " only numbers.\nThe area code must be included, and white" +
                  " space is not allowed";
              valid = false;
            if( ! phoneNumber2.getText().equals( "" ) ) {
              if( ! Validation.validPhone( phoneNumber2.getText() ) ) {
                if( ! message.equals( "" ) )
                  message += "\n\n";
                message += "Invalid secondary phone number. This field may contain" +
                " only numbers.\nThe area code must be included, and white" +
                " space is not allowed";
                valid = false;
            if( ! message.equals( "" ) )
              JOptionPane.showMessageDialog( gui, message, "Alert",
                  JOptionPane.ERROR_MESSAGE );
            return valid;
           * Clears all of the fields on the screen
          @Override public void clear()
            title.setSelectedIndex( 0 );
            firstName.setText( "" );
            surname.setText( "" );
            address1.setText( "" );
            address2.setText( "" );
            address3.setText( "" );
            county.setText( "" );
            postcode.setText( "" );
            phoneNumber1.setText( "" );
            phoneNumber2.setText( "" );
         * Stores the values entered by the user in the database
         * Also retrives the serial Customer_ID
         * These will then be stored in a Customer object to be used elsewhere.
         * @param database Connection to the database
         * @throws SQLException
           public void addNewCustomer(Connection database) throws SQLException
             String ADD_CUSTOMER_SQL = "INSERT INTO Customer_Details (First_Name," +
             " Last_Name, Address_1, Address_2, Address_3, County, Post_Code,"
            +"Phone_Number_1, Phone_Number_2) VALUES('"+firstName.getText()+"', '"+surname.getText()+
            "', '"+address1.getText()+"', '"+address2.getText()+"', '"+address3.getText()
            +"', '"+county.getText()+"', '"+postcode.getText()+"', '"
            +phoneNumber1.getText()+"', '"+phoneNumber2.getText()+"')";
             Address customerAddress = new Address(address1.getText(), address2.getText(), address3.getText(),
                 county.getText(), postcode.getText());
            Customer newCustomer = new Customer(findNextCustomerID(database), firstName.getText(),
             surname.getText(), customerAddress, phoneNumber1.getText(), phoneNumber2.getText());
             //Constructs and prepares a query to insert the details into the Database
             //Note: We need to set Customer_ID to be serial.
             addCustomerQuery = database.prepareStatement(ADD_CUSTOMER_SQL);
             addCustomerQuery.executeUpdate();
           * Constructs and prepares a statement to retrieve the ID of the customer just entered
           * Dirty dirty hack alert
           * @param database
           * @return
           * @throws SQLException
          public String findNextCustomerID(Connection database) throws SQLException
            String GET_NEW_ID_SQL = "SELECT Customer_ID FROM Customer_Details WHERE First_Name = '"
              +firstName.getText()+"' AND Last_Name = '"+surname.getText()+"' AND Address_1 = '"+address1.getText()+
              "' AND Address_2 = '"+address2.getText()+"' AND Address_3 = '"+address3.getText()+"' AND County ='"
              +county.getText()+"' AND Post_Code ='"+postcode.getText()+"' AND Phone_Number_1 = '"
              +phoneNumber1.getText()+"' AND Phone_Number_2 = '"+phoneNumber2.getText()+"'";
            Address customerAddress = new Address(address1.getText(),address2.getText(),address3.getText(),
                county.getText(),postcode.getText());
            getCustomerIDQuery = database.prepareStatement(GET_NEW_ID_SQL);
            ResultSet idResults = getCustomerIDQuery.executeQuery();
            while (idResults.next())
              customerID = (idResults.getString("Customer_ID"));
            return customerID;
          @Override public void configureButtons()
            // TODO Auto-generated method stub
        }As you can see the information has been written to the database already, and I have also created an instance of Customer with this information and Now I want to access the newCustomer instance from Buyer And Seller..
    package estateAgent;
    * @author scs5kjb
    * @version 23-03-07
    public class Buyer extends Customer
      private String contract, location, type;
      private int rooms, bedrooms, bathrooms, ensuite, stories;
      private double maxPrice, minPrice;
      private int garden;
      private String garage;
      Customer.
       * Creates a Buyer.
       * @param id The id of a buyer
       * @param firstName The first name of a buyer
       * @param lastName The last name of a buyer
       * @param address The address of a buyer
       * @param phone1 The primary phone number of a buyer
       * @param phone2 The secondary phone number of a buyer
       * @param contract The type of contract (Buy or Rent) wanted
       * @param location The location wanted
       * @param type The type of property wanted
       * @param rooms The number of rooms wanted
       * @param bedrooms The number of bedrooms wanted
       * @param bathrooms The number of bathrooms wanted
       * @param ensuite The number of ensuite wanted
       * @param stories The number of stories wanted
       * @param maxPrice The maximum price a buyer is willing to pay
       * for a property
       * @param minPrice The minimum price of a property
       * @param garden The size of garden wanted
       * @param garage The type of garage wanted
      public Buyer( String id, String firstName, String lastName,
          Address address, String phone1, String phone2, String contract,
          String location, String type, int rooms, int bedrooms,
          int bathrooms, int ensuite, int stories, double maxPrice,
          double minPrice, int garden, String garage )
        super( id, firstName, lastName, address, phone1, phone2 );
        this.contract = contract;
        this.location = location;
        this.type = type;
        this.rooms = rooms;
        this.bedrooms = bedrooms;
        this.bathrooms = bathrooms;
        this.ensuite = ensuite;
        this.stories = stories;
        this.maxPrice = maxPrice;
        this.minPrice = minPrice;
        this.garden = garden;
        this.garage = garage;
       * @return The type of contract wanted
      public String getContract()
        return contract;
       * @return The location wanted
      public String getLocation()
        return location;
       * @return The type of contract wanted
      public String getType()
        return type;
       * @return The number of rooms wanted
      public int getRooms()
        return rooms;
       * @return The number of bedrooms wanted
      public int getBedrooms()
        return bedrooms;
       * @return The number of bathrooms wanted
      public int getBathrooms()
        return bathrooms;
       * @return The number of ensuite wanted
      public int getEnsuite()
        return ensuite;
       * @return The number of stories wanted
      public int getStories()
        return stories;
       * @return The max. price wanted
      public double getMaxPrice()
        return maxPrice;
       * @return The min. price wanted
      public double getMinPrice()
        return minPrice;
       * @return The size of garden wanted
      public int getGarden()
        return garden;
       * @return The type of garage wanted
      public String getGarage()
        return garage;
       * @return A string representation of a buyer
      @Override public String toString()
        String string = super.toString();
        string += "\n\nBuyer Preferences:";
        if( contract != null )
          string += "\nType of contract: " + contract;
        if( location != null )
          string += "\nLocation: " + location;
        if( type != null )
          string += "\nType of Property: " + type;
        if( rooms != 0 )
          string += "\nNumber of Rooms: " + rooms;
        if( bedrooms != 0 )
          string += "\nNumber of Bedrooms: " + bedrooms;
        if( bathrooms != 0 )
          string += "\nNumber of Bathrooms: " + bathrooms;
        if( ensuite != 0 )
          string += "\nNumber of Ensuite: " + ensuite;
        if( stories != 0 )
          string += "\nNumber of Stories: " + stories;
        if( maxPrice != 0 )
          string += "\nMax. Price: " + maxPrice;
        if( minPrice != 0 )
          string += "\nMin. Price: " + minPrice;
        if( garden != -1 ) {
          if( garden == 0 )
            string += "\nGarden Size: None";
          else
            string += "\nGardenSize: " + garden;
        if( garage != null )
          string += "\nGarage Type: " + garage;
        return string;
    }See this is my Buyer class, for example a Customer can either be and buyer or seller so i create a generic customer and then use that information to create a buyer or seller depending on wha button they press...

  • How to create search function (af:query) using method in java

    hi All..:)
    i got problem with search custom (af:query), how to create search function/ af:query using method in java class?
    anyone help me....
    thx
    agungdmt

    Hi,
    download the ADF Faces component demo sources from here: http://www.oracle.com/technetwork/testcontent/adf-faces-rc-demo-083799.html It also has an example for creating a custom af:query model
    Frank

Maybe you are looking for

  • I am trying to change the Apple ID on my old iPhone 5c but it wants a password for an old Apple ID with and email that doesn't exist anymore

    MMy old iPhone 5c is wanting a password for logging into my apple account. The problem is that the email address its tied to doesn't exist anymore. I changed the email to a different one. But can't figure out how to change the email address on the ph

  • Cannot boot from OSX install disk

    I need to run disk utility to repair my boot drive. I am attempting to startup from my OSX install disk. However, I can't seem to get my machine to do this. My computer recognizes my install disk when it's in my superdrive. It mounts on the desktop a

  • Acrobat 9 Pro color profiles?

    here is my situation: I create multipage mockups in Illustrator (all of my Adobe software is Creative Suite 5 Design Premium running on Win7 32bit [I wish it was 64, but printers don't like it so.. yeah]) and after creating them , i then save them to

  • Strange Quicktime Bug

    I just got a MacBook less than a week ago, and so far there has been only one problem with it. When I try to watch a trailer on the Quicktime trailer site, no matter which one I choose (I haven't tried the HD ones), the picture is very distorted. The

  • Session problem in LazyFetch

    Hi all, I have two entities: User and InfoUser in my website. User has much "InfoUser". @OneToMany(cascade = CascadeType.ALL, mappedBy = "user") private List<InfoUser> infos = new LinkedList(); // Code.. public List<InfoUser> getInfos(){       return