?? charactergraph.java
字號:
package exercise;
import java.util.*;
public class CharacterGraph {
/**
* @param args
*/
public static void main(String[] args) {
Scanner scanner=new Scanner(System.in);
System.out.print("Please input a positive integer: ");
int n=scanner.nextInt();
System.out.println("Square");
for(int row=0;row<n;row++){
for(int col=0;col<n;col++){
System.out.print("* ");
}
System.out.println();
}
System.out.println("Triangle");
for(int row=0;row<n;row++){
for(int k=n-row-1;k>0;k--){
System.out.print(" ");
}
for(int col=0;col<row+1;col++){
System.out.print("* ");
}
System.out.println();
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -