你可以使用嵌套循環來打印九九乘法表,具體代碼如下:
public class MultiplicationTable {
public static void main(String[] args) {
int size = 9;
for (int i = 1; i <= size; i++) {
for (int j = 1; j <= i; j++) {
int product = i * j;
System.out.print(j + " * " + i + " = " + product + "\t");
}
System.out.println();
}
}
}
運行以上代碼,將會輸出九九乘法表。