What can be done to improve the following code fragment?
If ((counter % 10) == 0)
{
System.out.println("Counter is divisible by ten: " + counter) ;
Counter++;
}
Else
{
System.out.println("Counter is not divisible by ten: "
+ counter) ;
Counter++;
}
A) Move the duplicated code outside of the if statement
B) Shorten variable names
C) Move the brackets to save several lines of code
D) Add semicolons after the if condition and the else reserved word
Correct Answer:
Verified
Q2: Which of the following statements is true
Q9: Which of the following statements is (are)
Q10: Suppose one needs an if statement to
Q11: Assuming that the user provides 99 as
Q11: Which statement about an if statement is
Q12: Which of the following statements is correct
Q14: A store provides 10 percent discount on
Q17: Which of the following operators is used
Q17: Which of the following is the correct
Q18: What are the two parts of an
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents