该程序是要画一个余弦图形。
import java.applet.*;
import java.awt.*;
public class test3 extends Applet
{
public void start()
{
int x,y;
Graphics g=getGraphics();
for(x=0;x<=750;x++)
{
g.drawString(".",x,200);
if(x<=385)
g.drawString(".",360,x);
}
g.drawString("Y",330,200);
for(x=360;x<=370;x++)
{
g.drawString(".",x-10,375-x);
g.drawString(".",x,x-355);
}
g.drawString("X",735,230);
for(x=740;x<=750;x++)
{
g.drawString(".",x,x-550);
g.drawString(".",x,950-x);
}
for(x=0;x<=720;x++)
{
double a=Math.cos(x*Math. PI/180);
y=(int)(200+80*a);
g.drawString(".",x,y);
}
}
}
<html>
<head>
<title>余弦测试曲线</title>
</head>
<body>
<applet code=test3.class width=900 height=600>
</applet>
</body>
</html>
出现的问题:我在浏览器上打开html文件,没有出现余弦图形。