Leave a Reply 1

Your email address will not be published. Required fields are marked *


Ryan

Ryan

The question I’ve seen is…
public class Calculator {
public static void main(String[] args) {
int num = 5;
int sum;
do {
sum += sum;
} while ((num–) > 1);
System.out.println(“The sum is ” + sum + “.”);
}
}

and it fails to compile because sum has not been initialized.