because variable i (the loop counter) is shared between A and B. How it executes depends on the underlying platform, but roughly when i increments to 5 then nothing gets printed anymore...
To correct that and print 5 hello's and 5 world's, just remove the static keyword in the declaration of i.
HIH
------------------
Valentin Crettaz
Sun Certified Programmer for
Java 2 Platform