[求助]JAVA程序错误
import java.awt.Graphics;import java.applet.Applet;
public class Sum extends Applet
{
int N=1000;
int number;
public void paint(Graphics g)
{
int sum;
for(sum=0,number=2;number<=N;number+=2)
sum+=number;
g.drawString("Sum is"+sum,25,25);
sum=0;number=2;
for(;number<=N;)
{
sum+=number;
number+=2;
}
g.drawString("Sum is"+sum,25,45);
for(sum=0,number=2;number<=N;sum+=number,number+=2);
g.drawString("Sum is"+sum,25,65);
sum=0;number=2;
for(;;)
{
sum+=number;
number+=2;
if(number>N) break;
}
g.drawString("Sum is"+sum,25,85);
sum=0;number=2;
for(;;)
{
if(number>N) break;
sum+=number;
number+=2;
}
g.drawString("Sum is"+sum,25,105);
sum=0;
for(int number=2;number<=N;number+=2)
sum+=number;
g.drawString("Sum is"+sum,25,125);
}
}
用Jcreator pro 4.0编写上面的程序时,会出现这样的错误:
java.lang.NoSuchMethodError: main
Exception in thread "main"
处理已完成。
请大家多多指教!!