/* * $Id: Main.java,v 1.2 2003/03/28 17:50:45 gus Exp $ * * Developed for "Rethinking CS101", a project of Lynn Andrea Stein's AP Group. * For more information, see the * CS101 homepage or email . * * Copyright (C) 1998 Massachusetts Institute of Technology. * Please do not redistribute without obtaining permission. */ package cs101.util; /** * Main hides the public static void main( String[] argv ) construct * from students by providing a command line interface. Each command * line argument is treated as a class name that is instantiated once. *
* Copyright 1998 Massachusetts Institute of Technology * * @see cs101.util.Coerce * * @author Todd C. Parnell, tparnell@ai.mit.edu * @version $Id: Main.java,v 1.2 2003/03/28 17:50:45 gus Exp $ * */ public final class Main { public static void main(String[] argv) { for (int i = 0; i < argv.length; ++i) { try { Object o = Coerce.newInstanceByClassname( argv[i] ); } catch (CreationException ce) { System.err.println("Could not create " + argv[i]); System.err.println("Make sure you typed the class name correctly and that a no argument constructor exists."); } } } /** * Prevent instantiation */ private Main() {} } /* * $Log: Main.java,v $ * Revision 1.2 2003/03/28 17:50:45 gus * acomdate change in Coerce method name * * Revision 1.1.1.1 2002/06/05 21:56:32 root * CS101 comes to Olin finally. * * Revision 1.4 1998/07/24 17:19:29 tparnell * Placate new javadoc behavior * * Revision 1.3 1998/07/21 19:33:20 tparnell * added private Main() * * Revision 1.2 1998/06/07 17:00:07 tparnell * changed to use NewInstanceByClassname * * Revision 1.1 1998/06/04 23:18:14 tparnell * added a StringToObject method in Coerce, and a generic Main wrapper so * students can avoid public static void main(String[] argv) * */