Main Class:
package pkg1.a;
public class B {
public static void main(String[] args) {
for (int i = 0; i < 5; i++) {
for (int j = 0; j < 5; j++) {
if (i == 4 || i == 0 || j == 0 || j == 4) {
System.out.printf("* ");
} else {
System.out.printf(" ");
}
}
System.out.println("");
}
}
}
Output
* * * * *
* *
* *
* *
* *
* * * * *
Add your comment