import javax.swing.*;
import java.awt.*;
class Test
{
public static void main( String args[] )
{
System.out.println( args[ 0 ]);
}
}
One possible cause of your trouble is confusion about what class is
running. I would take the sample code and change the class name to
something distinctive that you have never previously used as a class
name. Add a distinctive output before the attempt to access the array.
Patricia
Regards,
Lee
Thanks
Catching ArrayIndexOutOfBoundsException seems an over-the-top way of
detecting this. If I need a certain number of arguments, usually the
first line will be something like:
if (args.length != 5)
{
System.err.println ("Usage: Foo <arg1> <arg2> ...");
System.exit (1);
}
(I sometimes use return instead of System.exit, to play nicer with other
Java code which runs main. I'm not terribly consistent on that one
yet...)
--
Jon Skeet - <sk...@pobox.com>
http://www.pobox.com/~skeet/
If replying to the group, please do not mail me too
- sarge