Click here to Skip to main content
12,690,140 members (31,826 online)

Java Printing int array returns gibberish?

darkknight2012 asked:

Open original thread
Could someone let me know why my code will not print an int array, instead it prints a string such as [[I@1d256a73

public class ArrayMultiplication {
	public static void main (String args []){
	int [][]a={{1,6,2},{4,18,3},{5,8,4}};
	int [][]b= {{9,12,13},{6,9,7},{32,4,3}};
	int [][]product = multiply (a,b);
	System.out.println (""+product);
	public static int [][] multiply (int [][]a, int[][]b){
		int aRows=a.length;
		int aColumns=a[0].length;
		int bRows=b.length;
		int bColumns=b[0].length;
		if (aRows != aColumns || bRows != bColumns) {
			return null; 
		int[][]resultantProduct = new int [aRows][aColumns];
		for (int i=0; i<aRows; i++) {
			for (int h=0; h<aColumns; h++) {
				resultantProduct [i][h] += a[i][h] * b[i][h];
		return resultantProduct;
Tags: Javascript, Java


When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the The Code Project Open License (CPOL).

Advertise | Privacy | Mobile
Web01 | 2.8.170117.1 | Last Updated 26 Mar 2009
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100