what is autoboxing in Java 1.5 ?

Discussion in 'Java' started by satya5321, Dec 17, 2007.

  1. satya5321

    satya5321 Banned

    Joined:
    Jul 4, 2007
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    0
    what is autoboxing in Java 1.5 ?.

    Hi I came across the word that is introduced in java1.5 : AutoBoxing

    can anybody tell what is autoboxing in detail.

    Thanks in Advance
     
    Last edited by a moderator: Dec 17, 2007
  2. nadunalexander

    nadunalexander New Member

    Joined:
    Sep 13, 2006
    Messages:
    34
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Student
    Java provide equivalent class types for primitive types.

    int - Integer
    double - Double etc...

    These classes are called wrapper classes, because they are wrapping the primitive values.
    Before java 1.5 to wrap a primitive value there are workarounds.

    From java 1.5 it is automated. That is why this is called autoboxing.
    from java 1.5 we can write

    Integer i=10;
    Double d=10.5;

    you don't need to write any object creation code
    Eg. Double d=new double();
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice