1、正的九九乘法表

public static void main(String[] args) {
        int i = 0;
        while (i<9){
            i++;
            int j = 0;
            while (j<i){
                ++j;
               //System.out.print(j+"*"+i+"="+j*i+" ");
                if(i*j<10){
                    System.out.print(String.format("%S * %S = %S   ",j,i,j*i));
                }else{
                    System.out.print(String.format("%S * %S = %S  ",j,i,j*i));
                }

            }
            System.out.println();
        }
    }

打印结果

 2、倒的九九乘法表

public static void main(String[] args) {
        int i = 9;
        while (i>0){

            int j = 1;
            while ( j<=i ){

                //System.out.print(j+"*"+i+"="+j*i+" ");
                if(i*j<10){
                    System.out.print(String.format("%S * %S = %S   ",i,j,j*i));
                }else{
                    System.out.print(String.format("%S * %S = %S  ",i,j,j*i));
                }
                j++;
            }
            i--;
            System.out.println();
        }
    }

结果

02-10 15:03