问答题

下面程序执行结果为:
1×1=1
2×1=2 2×2=4
3×1=3 3×2=6 3×3=9
……
9×1=9 9×2=18 9×3=27 9×4=36 9×5=45 9×6=54 9×7=63 9×8=72 9×9=81
请在每条横线处填写一个语句,使程序的功能完整。
注意:请勿改动main()主方法和其他已有的语句内容,仅在横线处填入适当的语句。
public class ForLoopStatement
public static void main(String args[])
int m,n;
for(m=1;m<10;_____________)
________________;
System.out.print(m+ "*" + n + "=" + m * n + " " );
_____________

【参考答案】

m++
for(n=1;n<=m;n++)
System.out.println();
热门 试题

问答题
下面是一个Applet程序,其功能是实现网页上的电子时钟,要求显示的格式为hh:mm:ss如02:04:50。提示:通过获取当前系统时间来实现。请改正程序中的错误(有下划线的语句),使程序能输出正确的结果。 注意:不改动程序的结构,不得增行或删行。 程序运行结果如下: import java.applet.*; import java.awt.*; import java.util.Date; * <applet code=”ex9_3.Class”,width;800 height=400> < applet> * public class ex9_3 extends Applet implements Runnable private Thread thTimer:null; private String strTime; private int tHour,tMin,tSec; public void init() setFont(new Font( Times New Roman ,Font.BOLD,20)); public void paint(Graphics Graph) Date dNow = new Date(); tHour = dNow.getHours(); tMin = dNow.getMinutes(); tSec = dNow.getSeconds(); if(tHour<=9) strTime = 0 + tHour + : ; else strTime = tHour + : ; if (tMin<=9) strTime = 0 + strTime + tMin + : ; else strTime = strTime + tMin + : ; if(tSec<=9) strTime = 0 + strTime + tSec; else strTime = strTime + tSec; Graph.drawString(strTime,80,80); public void start() if(thTimer == null) thTimer = new Thread(); thTimer.start(); public void run() while(thTimer != null) repaint(); try Thread.sleep(1000); catch (InterruptedException ie) public void stop () thTimer = null; ex9_3.html <HTML> <HEAD> <TITLE>ex9_3< TITLE> < HEAD> <BODY> <applet code= ex9_3.class width = 800 height=400> < applet> < BODY> < HTML>