Rahul.p Kumar wrote:ohh I see. length is not a method in String class. please read more about String's length and Array's length()
Ashish Paliwal wrote:Ok, then why does it work after putting braces around while loop.
Also, its not about int i, declare any variable, List l or Object o;
It will give errors.
I am not able to figure put what's the problem
Ashish Paliwal wrote:So, if I write int i = 10;
then this is a definition not a declaration. Should this work without braces of while loop ?
Rob Prime wrote:No, because it's still not a statement. It is a declaration (int i) with immediate definition (= 10).