Autoboxing and auto-unboxing are compiler modifications that permit previously illegal combinations of wrappers and primitives. : Boxing Unboxing « Utility Classes « SCJP

Home
SCJP
1.Java Source And Data Type
2.Operators
3.Modifiers
4.Type Casting
5.Statements
6.Object Oriented
7.Thread
8.Utility Classes
9.File
SCJP » Utility Classes » Boxing Unboxing 
8.10.12.Autoboxing and auto-unboxing are compiler modifications that permit previously illegal combinations of wrappers and primitives.
Boxing is the automatic assignment of a primitive value to a compatible wrapper type. 


public class MainClass {
  public static void main(String[] argv) {
    Integer wrappedInt = 25;

    // You can think of the line above as an abbreviation for

     wrappedInt = new Integer(25);

  }
}
8.10.Boxing Unboxing
8.10.1.Rules for overloading methods using widening, boxing, and var-args
8.10.2.Boxing, ==, and equals()
8.10.3.Where Boxing Can Be Used
8.10.4.Wrapper reference variables can be null
8.10.5.Overloading Method Matching
8.10.6.Overloading with Boxing and Var-args
8.10.7.Predict the output of the following
8.10.8.boxing beat var-args
8.10.9.Overloading When Combining Widening and Boxing
8.10.10.A boxing operation followed by a widening operation in order to match an invocation to a method.
8.10.11.Overloading in Combination with Var-args
8.10.12.Autoboxing and auto-unboxing are compiler modifications that permit previously illegal combinations of wrappers and primitives.
8.10.13.The wrapper on the left-hand side must correspond exactly to the primitive type on the right-hand side.
8.10.14.The following autoboxing assignment is illegal
8.10.15.Boxing requires an exact match between the wrapper class and the primitive type.
8.10.16.Boxing also occurs when a method's return type is a wrapper.
8.10.17.Unboxing is the automatic extraction of a wrapped value.
8.10.18.Unboxing the parameter
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.