User`s guide
Using Class Methods
Inthecasewhereindex is of type int[],eachelementoftheindex vector
is an index along one dimension of the
MWCharArray object. The valid range
for any index is
1 <= index[i] <= N[i],whereN[i] isthesizeoftheith
dimension.
Exceptions
The set method throws the following exception:
IndexOutOfBoundsException
The specified index parameter is invalid.
Example — Setting Values in a Character Array
Display a phrase stored in MWCharArray object A, change one of the characters,
and then display the modified phrase:
char[] chArray = {'G', 'a', 'r', 'y'};
MWCharArray A = new MWCharArray(chArray);
System.out.println(" I think " + A + " lives here." + "\n");
System.out.println("Changing the first character to M ...\n");
int[] index = {1, 1};
A.set(index, 'M');
System.out.println(" I think " + A + " lives here." + "\n");
When run, the example displays this output:
I think Gary lives here.
Changing the first character to M ...
I think Mary lives here.
4-115