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 -

php - Boolean search on database with 5 million rows, very slow -

css - Text drops down with smaller window -