This is my program in order to find two integers that are divisible either by 7 or 11.
public class Assignment1 {
public static void main(String[] args) {
int a = Integer.parseInt(args[0]);
int b = Integer.parseInt(args[1]);
boolean divisible = ( a % 7 == 0) || (a % 11 == 0);
System.out.println(divisible);
boolean divisible2 = (b % 7 == 0) || (b % 11 == 0);
System.out.println(divisible2);
}
}
The program is compiled with no errors. However, this shows up in Interactions when I try to Run the program:
run Assignment1
java.lang.ArrayIndexOutOfBoundsException: 0
at Assignment1.main(Assignment1.java:8)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at edu.rice.cs.drjava.model.compiler.JavacCompiler.ru nCommand(JavacCompiler.java:272)
>
What does this mean? What am I missing?
I am a beginner, so please add as much detail into the explanations as possible.