Return to Snippet

Revision: 69704
at August 20, 2015 18:53 by indecs


Updated Code
import java.util.Arrays;
public class Practive{
	public static void main (String[] args)
	{
		int [][] array = {{3,4,5},{6,7,8}};
		System.out.println(Arrays.deepToString(array));
		
	}
	
}

Revision: 69703
at August 20, 2015 07:59 by indecs


Initial Code
import java.util.Arrays;
public class Practive{
	public static void main (String[] args)
	{
		int [][] array = new int [3][3];
		int r, c;
		for (r=0;r<3;r++){
			for (c=0; c<3;c++){
				array[r][c] =1;
			}
		
		}
		System.out.println(Arrays.toString(array));
	}
}

Initial URL
http://stackoverflow.com/questions/16217452/why-wont-my-array-print-out-correctly

Initial Description
Must use deepToString() to print elements in an array.

Reference(old-toString()): http://stackoverflow.com/questions/16217452/why-wont-my-array-print-out-correctly

Initial Title
[note] Printing Array in Java

Initial Tags

                                

Initial Language
Java