The results of my code are the expected . But task always failed .
I have try two approaches
package en.codegym.task.jdk13.task06.task0633;
/*
Cutting down the middle
*/
public class Solution {
public static char[][] chars = {
{'a', 'b', 'c', 'd', 'e', 'f'},
{'j', 'h', 'i', 'j', 'k', 'l'},
{'m', 'n', 'o', 'p', 'q', 'r'},
{'s', 't', 'u', 'v', 'w', 'x'}};
public static void main(String[] args) {
printArray();
// for (int i = 0; i < 4; i++) {
// for (int j = 0; j < 6; j++) {
// if( (i>0 && i<3 ) && (j>0 && j<5) )
// {
// Solution.chars[i][j] = '-' ;
// }
// }
// }
for (int i = 1; i <3 ; i++) {
for (int j = 1; j <5 ; j++) {
Solution.chars[i][j] = '-' ;
}
}
printArray();
}
private static void printArray() {
for (int i = 0; i < chars.length; i++) {
for (int j = 0; j < chars[i].length; j++) {
System.out.print(chars[i][j] + " ");
}
System.out.println();
}
System.out.println();
}
}