0
Find the error in Java code (Hollow Rectangle)
public class Main { public static void main(String[] args){ for (int i=1;i<=4;i++){ for (int j=2;j<=5;j++){ if(i==1 || i==4 || j==1 || j==5) { System.out.print("*"); } else{ System.out.print(" "); } } System.out.println("*"); } } }
1 Odpowiedź
0
public class Main {
public static void main(String[] args){
for (int i=1;i<=4;i++){
for (int j=1;j<=5;j++){
if(i==1 || i==4 || j==1 || j==5) {
System.out.print("*");
}
else{
System.out.print(" ");
}
}
System.out.println();
}
}
}