graphics.java
来自「java课后题的详细答案」· Java 代码 · 共 51 行
JAVA
51 行
import java.io.IOException;
public class graphics {
/**
* @param args
* @throws IOException
*/
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
int number = 9 ;
xH(number);
}
public static void xH(int value) throws IOException{
int i = 0 ;
int j = 0 ;
for(j = 0 ; j < value/2 ; j++){
for(int k = 0 ; k < value/2 - j ; k++){
System.out.print(" ");
}
for(i = 0 ; i < 2 *j +1 ; i++){
System.out.print(" " + "*");
}
System.out.println("\n\n");
}
for(j = value/2 ; j >= 0 ; j--){
for(int k = 0 ; k < value/2 - j ; k++){
System.out.print(" ");
}
for(i = 0 ; i < 2 *j +1 ; i++)
System.out.print(" " + "*");
System.out.println("\n\n");
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?