01-03-2013, 11:52 AM
Good job, but
Doesn't really seem like the best idea, because i != 100 at that specific time. Why don't you have it setup to check if i = 100?
Also, I know these are probably remnants of an older idea or something, but the scanner that you created is never actually used, so it can definitely be removed!
Here's a cleaned up version:
[code2=java]public class New {
public static void main(String[]args){
countNumber();}
public static void countNumber(){
int i = 0;
System.out.println(i);
while (i < 100){//The while statement says that this will repeat 100 times
i++;
System.out.println(i);
}
if(i == 100){
System.out.println("I now equals 100");
}
}
}[/code2]
Code:
if(i == 101){
System.out.println("I now equals 100");
Doesn't really seem like the best idea, because i != 100 at that specific time. Why don't you have it setup to check if i = 100?
Also, I know these are probably remnants of an older idea or something, but the scanner that you created is never actually used, so it can definitely be removed!
Here's a cleaned up version:
[code2=java]public class New {
public static void main(String[]args){
countNumber();}
public static void countNumber(){
int i = 0;
System.out.println(i);
while (i < 100){//The while statement says that this will repeat 100 times
i++;
System.out.println(i);
}
if(i == 100){
System.out.println("I now equals 100");
}
}
}[/code2]