Run the following test in the debugger. As you step, notice that the Debugger puts "b[x++]" into the Variables panel. Each step will cause "x" to increment quickly causing an out of bounds exception.
public static void main(String[] args) throws Exception
{
byte[] b = new byte[4];
int x = 0;
for ( int i = 0; i < b.length; ++i )
{
b[x++] = (byte)i;
}
}
Description
Run the following test in the debugger. As you step, notice that the Debugger puts "b[x++]" into the Variables panel. Each step will cause "x" to increment quickly causing an out of bounds exception.
public static void main(String[] args) throws Exception
{
byte[] b = new byte[4];
int x = 0;
for ( int i = 0; i < b.length; ++i )
{
b[x++] = (byte)i;
}
}