java - Error - not a statement when I have already defined the variable I use -


it's giving me error "not statement" , can't understand why.

here's error telling me:

coolnumbers.java:17: error: not statement     for(num; num <= meme; num++){         ^ 

here's (now updated) code:

    import static java.lang.system.*;  public class coolnumbers {     int num = 6;     int iscoolnum;     int meme;      public int meth(int meme){      for(num; num <= meme; num++){         if (num % 3 == 1 && num % 4 == 1 && num % 5 == 1 && num % 6 == 1){             iscoolnum++;         }     }             return iscoolnum;      }  } 

your loop:

for(num; num <= meme; num++){ 

should be:

for(; num <= meme; num++){ 

i assume num not need initial value (since gave 1 when declared it). if does, need like:

for(num = 0; num <= meme; num++){ 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -