Hey, I am reading about looping methods right now and I understand what it is doing but there are 2 parts that I’m not clear about and it would be great if some one can explain it to me. Here is the basic part of it
I don’t understand what the “ “ means in the (number + “ “ ); Normally the quotes are used to enter some test that will be printed on the screen?
The other part of what I don’t get is the line under ‘number += 2; ‘ I know this line from reading the explanation adds 2 to the number variable since it counts up in even numbers. But the way it is written confuses me. Should it not be something like ‘ number = number + 2 ‘ why is it ‘+=’
Thanks for the help.
-Lars
Code:
{
int number = 2;
while (true)
{
if (number == 12);
break;
System.out.print (number + “ “ );
Number += 2;
System.out.println();
}
}
I don’t understand what the “ “ means in the (number + “ “ ); Normally the quotes are used to enter some test that will be printed on the screen?
The other part of what I don’t get is the line under ‘number += 2; ‘ I know this line from reading the explanation adds 2 to the number variable since it counts up in even numbers. But the way it is written confuses me. Should it not be something like ‘ number = number + 2 ‘ why is it ‘+=’
Thanks for the help.
-Lars