Question: What can be done to improve the following code fragment? if ( ( counter % 1 0 ) = = 0 ) { System.out.println (
What can be done to improve the following code fragment?
if counter
System.out.printlnCounter is divisible by ten: counter;
counter;
else
System.out.printlnCounter is not divisible by ten:
counter;
counter;
Question options:
Add semicolons after the if condition and the else reserved word
Shorten variable names
Move the brackets to save several lines of code
Move the duplicated code outside of the if statement
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
