求解答关于do...while的问题
public static void main(String[] args) {
int sum=0;
int num=2;
do {sum=sum+num;
num=num+2;
}while(num<=50);
}
System.out.println("0到50以内的偶数的总和为:"+sum); //这一行提示有错误
}
错误信息是:
Multiple markers at this line
- Syntax error, insert ")" to complete MethodDeclaration
- Syntax error on token ".", @ expected after this token
- Syntax error, insert "SimpleName" to complete
QualifiedName
- Syntax error, insert "Identifier (" to complete
MethodHeaderName