// play with arrays of objects with static things
// (a question was posed in lecture)

//---------------------------------------------------------
// Test CLASS
//---------------------------------------------------------
class Test {
    static int k = 1;
    public static void print() {
	System.out.println("\tThis is static.");
    } // method print
} // class Test
//---------------------------------------------------------

public class array_static {
    
    public static void main(String args[]) {
	
	// create a 2-element array that references
	// objects of class Test
	Test[] Ts = new Test[2];
	
	// note how the info in Test is static
	// now, you "get around" the rule of 
	// instantiating each element of the array
	for(int i=0; i<=1; i++) {
	    System.out.println("Test #:" + (i+1));
	    System.out.println("\t" + Ts[i].k);
	    Ts[i].print();
	}

	// is this good or bad style?
	// in terms of encapsulation, no
	// use the approach shown in this example
	// for info that is really, really public
	
  } // method main

} // class array_static


/* Output:
Test #:1
        1
        This is static.
Test #:2
        1
        This is static.
*/

