I would recommend running this code through the Online Java Visualizer, to see how it runs step-by-step, and what the value of the variables are at each step. However, to run it, you'll need to change it into a full Java class with a main
method, like this:
public class OddStuffTest {
public static void main(String[] args) {
oddStuff();
}
public static void oddStuff() {
int number = 4;
for (int count = 1; count <= number; count++) {
System.out.println(number);
number = number / 2;
}
}
}
If watching it execute step-by-step doesn't help, I believe our dedicated tutor Maegan will still be in the Olin 204 lab tonight from 7-9 PM tonight (despite the blizzard!), and she could certainly help you out!
Hopefully one of your classmates will also post a more detailed answer than this!