Here is the problem that I am working on :
Use the wrapper classes to create an application that reads a 5 digit number from the user and then reports back the sum of those digits.
Here is my non-working code. Please help me understand what I'm doing wrong.
public static void main(String[] args) {
String num = null;
Scanner scan = new Scanner(System.in);
System.out.println("Enter a five digit number: ");
num = scan.next();
System.out.println(num);
for (int i = 0; i <1; i++) {
num = Integer.parseInt();
System.out.println(num);
}
}
}
The error is in the second line of the for loop, "num = Integer.parseInt.();" The error says, "No suitable method found for parseInt()"

New Topic/Question
Reply



MultiQuote






|