|
|
| SinusGraph.java |
char[][] canvas = new char[24][60]; |
![]() | Arrays can be constructed from arrays.
|
![]() | In the example above, we have an array of arrays
of char values.
|
![]() | It is possible to allocate a multidimensional array
using one new operator if all dimensions are specified.
|
![]() | It is also possible to construct arrays individually
and to end up with an array of arrays with possibly
different lengths or even null values.
|
| Graph.java |
/**
* Clear the canvas, i.e. replace all characters by spaces.
*/
public void clear() {
for (int i = 0; i < rows; ++i) {
for (int j = 0; j < columns; ++j) {
canvas[i][j] = ' ';
}
}
}
|
|
| Copyright © 2001, 2002 Andreas Borchert, converted to HTML on February 11, 2002 |