/* * TestClass.java - This is the class we load with the class loader. * * Copyright (c) 1996 Chuck McManis, All Rights Reserved. * * Permission to use, copy, modify, and distribute this software * and its documentation for NON-COMMERCIAL purposes and without * fee is hereby granted provided that this copyright notice * appears in all copies. * * CHUCK MCMANIS MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE * SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING * BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. CHUCK MCMANIS * SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT * OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. */ import java.util.Random; import java.util.Vector; public class TestClass implements LocalModule { /* * This is an example of a class reference that will be resolved * at load time. */ Vector v = new Vector(); /* * This is our start function, */ public void start(String opt) { /* This reference will be resolved at run time. */ Random r; System.out.println("Running the Test class, option was '"+opt+"'"); System.out.println("Now initializing a Random object."); r = new Random(); for (int i = 0; i < 5; i++) { v.addElement(new Integer(r.nextInt())); } /* This reference should get the cached copy of random. */ r = new Random(); System.out.println("A series of 5 random numbers:"); for (int i = 0; i < v.size(); i++) { Integer z = (Integer)v.elementAt(i); System.out.println(i+": "+z); } } }