# Introduction

A **type wrapper** is an object that contains an
**instance variable** of the corresponding **primitive type**.
The type wrapper also provide constants and methods useful when dealing with the
corresponding primitive type.

# Discussion

Primitive Type | Type Wrapper |
---|---|

boolean | Boolean |

char | Character |

byte | Byte |

short | Short |

int | Integer |

long | Long |

float | Float |

double | Double |

There are also several wrappers without a corresponding primitive type.

Wrapper | Group | Type | Bits | Example |
---|---|---|---|---|

Void | Void | void | n/a | n/a |

Number | Superclass | n/a | n/a | `Number n = new Byte((byte) 15);` |

BigInteger | Integer | n/a | arbitrary-precision | `java.math.BigInteger bi = java.math.BigInteger.ONE;` |

BigDecimal | Floating-point | n/a | arbitrary-precision | `java.math.BigDecimal bd = new java.math.BigDecimal(3.14);` |

## No comments:

Post a Comment