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
你把输出语句写到main函数外面去了,删掉输出语句前面的括号