插入 ;用java完成语句 [英] Insert ; to complete statement with java
本文介绍了插入 ;用java完成语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我运行此代码时,我得到:
When i run this code , im getting :
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
Syntax error, insert ";" to complete Statement
at practicebook.sum1.main(sum1.java:86)
为行:
for the line :
System.out.printf("Sum of %s's odd digits: %f", number, odd_digits_sum);
/
import java.util.Scanner;
public class sum1 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Number: ");
int number = input.nextInt();
input.close();
int odd_digits_sum = 0;
while (number > 0) {
int digit = number % 10;
if (digit % 2 != 0) {
odd_digits_sum += digit;
}
number /= 10;
}
System.out.printf("Sum of %s's odd digits: %f", number, odd_digits_sum);
*/
}
}
//end main}
// end class
我尝试过:
************************************************** ************************************************** ************************************************** ******************************
What I have tried:
************************************************************************************************************************************************************************************
推荐答案
这个
This
/
和
and
*/
不应该在此代码中。
should not be in this code.
这篇关于插入 ;用java完成语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文