Example of Wrapper Usage

new Double(3.1415927)

creates a Double containing the indicated value.

  Double d;
    :
    :
  d = new Double(3.14);

 

  

    a double which is the retrieved  value from the wrapper

 

Note:  The wrappers in java.lang are immutable ;

   Once the value is wrapped, it can't be changed.

[You could code your own wrappers which do things differently.]

 

To Next Slide To Previous Slide To Contents