FileDocCategorySizeDatePackage
ArrayTwoDObjects.javaAPI DocExample1348Sat Mar 03 15:21:54 GMT 2001None

ArrayTwoDObjects

public class ArrayTwoDObjects extends Object
Show Two-Dimensional Array of Objects

Fields Summary
Constructors Summary
Methods Summary
public static java.lang.String[][]getArrayInfo()
Return list of subscript names (unrealistic; just for demo).

		String info[][];
		info = new String[10][10];
		for (int i=0; i < info.length; i++) {
			for (int j = 0; j < info[i].length; j++) {
				info[i][j] = "String[" + i + "," + j + "]";
			}
		}
		return info;
	
public static java.lang.String[][]getParameterInfo()
Return list of allowable parameters (Applet method).

		String param_info[][] = {
			{"fontsize",    "9-18",    "Size of font"},
			{"URL",    "-",    "Where to download"},
		};
		return param_info;
	
public static voidmain(java.lang.String[] args)
Run both initialization methods and print part of the results

		print("from getArrayInfo", getArrayInfo());
		print("from getParameterInfo", getParameterInfo());
	
public static voidprint(java.lang.String tag, java.lang.String[][] array)
Print selected elements from the 2D array

		System.out.println("Array " + tag + " is " + array.length + " x " + 
			array[0].length);
		System.out.println("Array[0][0] = " + array[0][0]);
		System.out.println("Array[0][1] = " + array[0][1]);
		System.out.println("Array[1][0] = " + array[1][0]);
		System.out.println("Array[0][0] = " + array[0][0]);
		System.out.println("Array[1][1] = " + array[1][1]);