eg1:
class ForDemo
{
public static void main(String[] args)
{
int x= 0;
for (; x<=10; x++ )
{
if(x%2!= 0);
为什么 System.out.println("x="+x); 在循环体内和循环体外,运行的结果都正确呢?求高手指点迷津!!!
}
}
}
---------------------------------------------------------------------------------------
eg2:
class ForDemo
{
public static void main(String[] args)
{
int x= 0;
for (; x<=10; x++ )
{
if(x%2!= 0);
}
System.out.println("x="+x);
}
}
|
|