I have two erros which I have tried everything to fix them
C:\Documents and Settings\java:14: array required, but java.lang.String found
ID[count] = ID;
^
C:\Documents and Settings\java:15: array required, but int found
mark[count] = mark;
heres the code
class Module
{
String[] ID = new String[10];
int[] score = new int[10];
int setID(String ID, int mark, int count){
//id, mark and count get passed from the main method
ID[count] = ID;
score[count] = mark;
public class Test{
/** Main method */
public static void main(String[] args) {
for(int count = 0;count<10;count++){
String ID = JOptionPane.showInputDialog(null,
"Enter the Students ID",
"Programming 2",
JOptionPane.QUESTION_MESSAGE);
String num = JOptionPane.showInputDialog(null,
"Enter the Students score",
"Programming 2",
JOptionPane.QUESTION_MESSAGE);
int mark = Integer.parseInt(num);
Module withData = new Module(ID, mark, count);
System.out.println("Student data = "+ withData.setID());