Friday, October 14, 2016

a program in java bean to implement indexed properties of a bean

Aim: write a program in javabean to implement indexed properties of a bean.

Program:

package sunw.demo.indexed;
import java.awt.*;
import java.io.*;
public class PieC
{
            private double data[ ];
            public double getData(int index)
            {
                        return data[index];
            }
            public void setData(int index, double value)
            {
                        data[index] = value;
            }
            public double[ ] getData( )
            {
                        return data;
            }
            public void setData(double[ ] values)
            {
                        data = new double[values.length];
                        System.arraycopy(values, 0, data, 0, values.length);
            }
}

Output:


Labels:

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home