package pro2; public class Table { public static void main(String[] args) { table(); } public static void printTable(String s[][]){//二维数组的打印 for(int i=0;i<s.length;i++){ for(int j=0;j<s[i].length;j++){ System.out.print(s[i][j]+"\t"); } System.out.println(); } } public static void table(){//乘法表存入二维数组 String s[][]=new String[9][]; int num=0; for(int i=0;i<s.length;i++){ s[i]=new String[i+1]; for(int j=0;j<s[i].length;j++){ num=(i+1)*(j+1); s[i][j]=(j+1)+"*"+(i+1)+"="+num; } } printTable(s); } }