Question: What is the difference between these examples of code? Example 1 ) int count; for ( count = 0 ; count < 1 0 0
What is the difference between these examples of code?
Example
int count;
for count ; count ; count
System.out.printlnThe counter is count;
assume end of method
Example
for int count ; count ; count
System.out.printlnThe counter is count;
assume end of method
Group of answer choices
A Both will work. In Example the scope of the variable count will exist outside of the loop.
B Both will work. In Example the scope of the variable count will only exist within the loop. This is fine as long we don't need to access variable count outside of the loop.
C Neither will work because we need always need the braces for a for loop.
D Both A and B are true
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
