java - Object type reference variable assigned to a primitive -


in java, int primitive type , integer object.

    integer x = 4; 

this line of code produces no errors, though think technically should if there no special case it. it's object type reference variable being assigned primitive type, not make sense. why not produce error?

this called auto-boxing.

the compiler automatically box primitives when used objects.


Comments

Popular posts from this blog

php - cannot display multiple markers in google maps v3 from traceroute result -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

css - Text drops down with smaller window -