error: illegal start of expression
private static void printArray() {
^
Since the minimum distance from interior elements to wedge must be greater than 0, I use (i>0||j>0||chars.length-i>0||chars[i].length-j>0).
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();
//write your code here
for (int i = 0; i < chars.length; i++) {
for (int j = 0; j < chars[i].length; j++){
if(i>0||j>0||chars.length-i>0||chars[i].length-j>0)
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();
}
}