Let's say that I have the following:
int a = 2;
Number b = (Number) a;
System.out.println(b); // Prints 2
http://java.sun.com/docs/books/jls/first_edition/html/15.doc.html#238146 says that a primitive value may not be cast to a reference type. Does Java know to create an Integer from the primitive int and then cast to the superclass? How exactly does Java handle this behind the scenes? Thanks!