新手学了半天,做到99乘法表不会了,求帮忙
System.out.print(i+"*"+j+"="+j*j+"");这个输出追得那两个双引号什么意义!!
import javax.swing.JOptionPane; public class Nine { static String str=""; public static void draw(int i,int j) { if(j<=i) { str+=i+"*"+j+"="+(i*j); str+=i*j>9?" ":" "; draw(i,j+1); } } public static void draw(int n) { if(n>0) { draw(n-1); draw(n,1); str+="\n"; } } public Nine() { draw(9); JOptionPane.showMessageDialog(null, "打印结果:\n"+str,"九九乘法表",JOptionPane.INFORMATION_MESSAGE); str=""; } public static void main(String[] args) { new Nine(); } }