I am doing an exercise in a book and there is a part of the code that I don't understand. To my understanding, a for loop always has three parts, initialization, condition, and iteration. Yet, in the code below, the for loop has none of the three. Although it does have two semicolons inside the parentheses, which makes me guess that the three parts are left blank, I still do not understand how any comparison, initialization or iteration is done without any values entered. Please explain to me how the loop works with the parts left blank. The code is below. I did not include any of the class definitions only the method calls.
Thanks,
Kevin Haynes
class HelpClassDemo { public static void main(String args[]) throws java.io.IOException { char choice, ignore; Help hlpobj = new Help(); for(;;) { do { hlpobj.showmenu(); choice = (char) System.in.read(); do { ignore = (char) System.in.read(); } while(ignore != '\n'); } while( !hlpobj.isvalid(choice) ); if(choice == 'q') break; System.out.println("\n"); hlpobj.helpon(choice); } } }