That is a god start, but there are two things that I would like to point out. First of all, your for loop includes an incrementer, as it should (that's the i++). What this means is that every time the program runs through this loop, it adds one to i. Therefore,
you should not have an additional i++ later in your code. Otherwise, every time the loop iterates (or runs through a cycle), i will be incremented twice, meaning you will skip over half the numbers.
Second, your solution should work, but it is not exactly how I intended for it to be done. You observed that the number of integers less than 1000 that are divisible by a given number is 1000 divided by that number. Had I not included a sample output, however, you would not have been able to make this observation. This may be a little advanced, as I am not sure how in depth you are at this point in
Java, but a very operation is the modulo operator: %.
Modulo basically means remainder. For example, 5%2=1, because when 5 is divided by two, the remainder is one. Here are some more samples... hopefully you can catch on, and if not, just google
modulo. The easiest way, then, to determine if one number is divisible by another, is to check if one modulo the other is equal to zero, meaning that the second goes into the first a whole number of times. For example:
10%2=0, so 10 is divisible by 2.
190%19=0, so 190 is divisible by 19.
39%3=0, so 39 is divisible by 3.
but,
35%8=3, and since 3 is not zero, 35 is not divisible by 8.
Now, I hope I haven't veered too off topic with this discussion, but chances are if you are learning loops now, you will be learning basic operations, +-/*%, soon. If you need anything else, please don't hesitate to ask!