Initializing Multidimensional Arrays
Introduction.
We have described a bit about multidimensional arrays in the last webpage.
Now we will discuss some about initializing them. Since we have more
dimensions to work with you should expect to see more options. You can still initialize arrays making use of lists, but this can be done for the entire array at once or for selected parts.
Now we will develop and discuss an example to illustrate these options. You should call the following applet InitMultiDimArray.java. |
import java.awt.Container; import javax.swing.*; public class InitMultiDimArray extends JApplet {
} |
The HTML file follows and should be called InitMultiDimArray.html. |
<html> <applet code="InitMultiDimArray.class" width=200 height=300> </applet> </html> |
Before we discuss the code, you should run the program to get the following output. |
We will use our usual outline approach to discuss the
code.
That's it! |