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("*"); } } }

30th May 2022, 10:47 AM
Karan singh
Karan singh - avatar
1 ответ
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(); } } }
30th May 2022, 11:17 AM
Thineshan Panchalingam
Thineshan Panchalingam - avatar