I am new to java. when i try some code, i get the 'Caught ArrayIndexOutOfBoundsException: 0' message. i need help how to address the problem.
the code was as follows. I am leaving out the class name (first line)
public static void main(String[] args){
try {
double hours = Double.valueOf(args[0]).doubleValue();
double rate = Double.valueOf(args[1]).doubleValue();
double pay;
hours = 0;
if (hours > 40) {
pay = rate * 40 + 1.5 * rate * (hours - 40);
}
else {
pay = rate * hours;
}
System.out.println("The paycheck is " + pay + " dollars.");
} catch (ArrayIndexOutOfBoundsException e) {
System.err.println("Caught "
+ "ArrayIndexOutOfBoundsException: "
+ e.getMessage());
}
}
thanks