kvarnerexpress 0 Report post Posted October 4, 2005 First of all, bear with me. Only on my 3rd week of java programming, so stupid error will occuor Lets start with the code in question: Code: public Matrix multiplyMatrix(Matrix B) { if(coln != B.returnRowlength()) { Matrix local = new Matrix(rows, B.returnColnlength()); int value = 0; for(int i = 0; i < rows; i++) // Controls row count { for(int j = 0; j < B.returnColnlength(); j++) // Control coln count { for(int k = 0; k < coln; k++) { value = value + (array[i][k] * B.returnValue(k,j)); local[i][j] = value; } } } return local; } else { System.out.print("Dimension does not match. Multiplay function cannot be executed."); } } The problem is within the: local[j] = value;I get this error message: array required, But matrix found local is an array, so why does it say array required? Thanks,kvarnerexpress Share this post Link to post Share on other sites
beeseven 0 Report post Posted October 4, 2005 APCS in Java? I'm in that class, too... and we just got that problem today. I haven't finished it but basically your problem is that local is an object, not an array. Arrays are special, so they can be accessed using []'s, but objects can't. What I did for that part was to make local a two dimensional array (int[][] local = new int[number of rows in a][number of cols in b]) and a constructor for the Matrix class that took a two dimensional array argument: int[][] data;public Matrix(int[][] a){ data = a;}Then at then end I put "return new Matrix(local)" Share this post Link to post Share on other sites