Compiling JuXing.java......
------Output------
* * * * *
* *
* *
* *
* * * * *
[Finished in 1.9s]
class JuXing{
public static void main(String[] args){
String[][] arr = new String[5][5];
for (int i=0;i<5 ;i++ ) {
for (int j=0;j<5 ;j++ ) {
if(i == 0 || i == 4 || j == 4 || j == 0){
arr[i][j] = "*";
}
else
arr[i][j] = " ";
}
}
for (int i=0;i<5 ;i++ ) {
for (int j=0;j<5 ;j++ ) {
System.out.print(arr[i][j]+" ");
}
System.out.println();
}
}
} |