wilfrid100
Newbie level 6
Code:
public static Object[][] readTextFile()
throws FileNotFoundException, IOException
{
try
{
BufferedReader in = new BufferedReader(
new FileReader("C:/Documents and Settings/seng/Desktop/testfile/assignment_matrix.txt"));
List list = new ArrayList();
String text;
while((text = in.readLine()) != null)
{
Object[] out = text.split(" "); // Separated by "whitespace"
for (int index = 0; index< out.length; index++)
out[index] = Integer.parseInt((String)out[index]); //problem here
list.add(out);
}
Object[][] output = (Object[][])list.toArray(new Object[0][0]);
return output;
}
catch ( IOException exc )
{
exc.printStackTrace();
}
return new Object[0][0];
}
does any1 can let me know how do i can solve for tis problem?
Code:
out[index] = Integer.parseInt((String)out[index]);
Code:
incompatible type, found: int, required: java.lang.Object