Trying to find the correct error when args[0]is not found.
class Main
{
public static void main(String[] args)
{
try
{
String filename = args[0];
}
catch (ExceptionInThread e)
{
System.out.println(“No file found”);
}
}
}
I keep getting the samme error:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: o at Main.main(Main.java:9)
Can someone tell me how I can find the correct error to catch?