This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I think Ahmed is right. The reason for this is an optimization in the Integer class. Autoboxing is done by calling the method Integer.valueOf(...). The Javadoc of this method explains why it works like this:
Returns a Integer instance representing the specified int value. If a new Integer instance is not required, this method should generally be used in preference to the constructor Integer(int), as this method is likely to yield significantly better space and time performance by caching frequently requested values.
It doesn't say exactly what the "frequently requested values" are, but the output of your program demonstrates that 1 is one of the cached values, and 10000 is not.
If you really want to know all the details, you can lookup the source code for class Integer, which you can find in the file src.zip in your JDK installation directory. I looked it up (for JDK 1.6.0 update 2) and it looks like this:
So all numbers between -128 and 127 (inclusive) are cached.
I doubt that you have to know implementation details like this for the SCJP exam.