can setter method have more than 1 parameter in JavaBeans?

Discussion in 'Java' started by Matt, Dec 3, 2004.

  1. Matt

    Matt Guest

    In JavaBeans, the getter and setter methods always have signatures like this:
    public void setXxx(Type xxx)
    public Type getXxx()

    Can we declare a setter method that takes more than 1 parameter, like
    public void mysetter(Type xxx, Type yyy)
    This article (
    in Indexed Properties section has 2 parametes in setter method.

    I am confused.

    Please advise. Thanks!!
    Matt, Dec 3, 2004
    1. Advertisements

  2. One parameter is the value and one parameter is the index (int).

    The index is the position in the underlaying array or collection
    by base zero ( 0....* )

    Heiner Kuecker
    JSP WorkFlow PageFlow Page Flow FlowControl Navigation:
    Expression Language Parser:
    Heiner Kücker, Dec 4, 2004
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.