javax.swing.JOptionPane;

import javax.swing.JOptionPane;

public class printtable {

	public static void main(String[] args) {
		String a= JOptionPane.showInputDialog("请输入起始值", null);
		//System.out.println(a);
		int c = Integer.parseInt(a); 
		int b=c;
		//System.out.println(b);
		String a1= JOptionPane.showInputDialog("请输入终止值", null);
		int c1 = Integer.parseInt(a1); 
		int b1=c1;
		printtable pt = new printtable();
		pt.printtable(b, b1);
	}
	public static void printtable(int a,int b)
	{
		for(int i=a;i<=b;i++)
		{
			for(int j=a;j<=i;j++)
			{
				System.out.print(j+"*"+i+"="+i*j+" ");
				
			}
			System.out.println();
		}
	}
}

Java小白开始上车了 

你可能感兴趣的:(Java)