I\'ve declared public static arrays for name and id:
public static String[] name = new String[19];
public static int[] id = new int[19];
You have a collision between the static name
String array and the local name
String variable passed to the add
method.
The best solution would be to use different names. It would make the code much easier to understand.
If you still insist on using the same name, you can resolve the name collision by accessing the static array using the class name:
YourClassName.name[i]= name;
The same applies to your id
int array and id
int variable.