Sahil Rally wrote:j=i; // This is compiling fine, But y ??
Because of auto-unboxing, as is explained on the page Henry linked to.
System.out.println(j); // Printing value 45, Again a Magic, Y ?
System.out is a PrintStream, and its println method is overloaded to take all primitive types. Therein, it will convert the primitive into a String using String.valueOf, and that String is then printed.