class X {
public static void main(String[] args) {
int i = 0;
while (i++ < args.length) {
System.out.print(args[i]);
}
}
}
Here is the explanation:
Inside the while loop, the conditional part is i++ < args.length. i.e
i=i+1(but this is a postfix operator).So for the first execution of while loop, the value of i=0 but the value becomes 1 after that conditional part. Like this, whenever i value reaches to 5, after post fix operation, the value becomes 6 inside the while loop. if u try to get the value of args[6],compiler will throws ArrayIndexOutOfBoundException (Subclass of RuntimeException).
If you use while(++i<args.length), then the output will be BCDEF.
----------------
Nayan