java - Trying to get my matrix printed not the heap address -
java - Trying to get my matrix printed not the heap address -
the code seems run except getting not matrix of specified (by user) size think heap address here's returns when user inputs 2 size , 4 numbers:
enter matrix size: 2 come in 2 2 matrix row row: 2 3 4 5 row-sort matrix is...[[d@3c954549build successful (total time: 8 seconds)
here code....thank in advance.
import java.util.scanner; public class exercise7_26m { public static void main (string[]args) { //prompt user input of matrix size system.out.println("enter matrix size: "); scanner input = new scanner(system.in); int size = input.nextint(); double[][] m = new double [size][size]; //prompt user input of array system.out.print("enter " + size + " " + size + " matrix row row: "); (int row = 0; row < 2; row++) (int column = 0; column < 2; column++) m[row][column] = input.nextdouble(); system.out.print("the row-sort matrix is..." + m); }
java arrays not override tostring()
getting default implementation object
. instead, can utilize arrays.deeptostring(object[])
like
system.out.println("the row-sort matrix is..." + arrays.deeptostring(m));
java matrix heap
Comments
Post a Comment