Solved

What Can Be Done to Improve the Following Code Fragment

Question 13

Multiple Choice

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:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents