created a new method, prescribed the following:
static void changediagonal () {
System.out.PrintLN ("Task number 4");
int [] [] listdoblediagonal = new int [10] [10];
int i;
For (i = 0; I & LT; ListDoubleDiagonal.Length; I ++) {
ListDoubleDiagonal [i] [i] = 1;
ListDoubleDiagonal [i] [listdoblediagonal.length - 1 - i] = 1;
}
System.Out.PrintLN (ArrayS.DeepTostring (ListDoubleDiagonal));
System.Out.printLN ();
}
Currently, an array goes into the console, but each item does not start with a new line, but I would like. Tell me, please, some can there be a way another to output 10 lines?
Answer 1, Authority 100%
The element of the two-dimensional array is a one-dimensional array. We go around the two-dimensional array and derive its elements. This can be done in the cycle:
for (int i = 0; i & lt; listdoblediagonal.length; i ++) {
System.Out.PrintLN (Array.Tostring (ListDoubleDiagonal [i]));
}
You can stand on the streets:
arrays.stream (ListDoubleDiagonal)
.Foreach (ARR - & GT; System.out.PrintLN (Arrays.Tostring (Arr)));
Answer 2
Two-dimensional array output line:
int [] [] arr = new int [10] [10];
// Filling the array
Intstream.range (0, 10) .Foreach (i - & gt; {
Arr [i] [i] = 1;
Arr [i] [9 - i] = 1;
});
// Conclusion Building
Arrays.stream (Arr) .map (Arrays :: Tostring) .Foreach (System.out :: PrintLN);
[1, 0, 0, 0, 0, 0, 0, 0, 0, 1]
[0, 1, 0, 0, 0, 0, 0, 0, 1, 0]
[0, 0, 1, 0, 0, 0, 0, 1, 0, 0]
[0, 0, 0, 1, 0, 0, 1, 0, 0, 0]
[0, 0, 0, 0, 1, 1, 0, 0, 0, 0]
[0, 0, 0, 0, 1, 1, 0, 0, 0, 0]
[0, 0, 0, 1, 0, 0, 1, 0, 0, 0]
[0, 0, 1, 0, 0, 0, 0, 1, 0, 0]
[0, 1, 0, 0, 0, 0, 0, 0, 1, 0]
[1, 0, 0, 0, 0, 0, 0, 0, 0, 1]