ITSourceCode.com

We Exist to Provide 100% Free Source Code and Tutorials

Custom Search

Wrapper Classes in Java

For every primitive data, there are corresponding wrapper classes. There are total eight primitive data type and eight corresponding wrapper classes which are listed below:

  1. byte : Byte
  2. short: Short
  3. int : Integer
  4. long : Long
  5. float: Float
  6. double : Double
  7. char : Character
  8. boolean: Boolean

All these Wrapper classes are available in java.lang package developed by Sun Developers.

 

Important Points to ponder:

  1. Every wrapper class is a final class.
    For Example: public final class Short{ …}
  2. Every Wrapper class is a type of comparable. Since every Wrapper class is implementing Comparable class we can do sorting of the members of these classes.
  3. Every Wrapper class is a type of Serializable. Every wrapper oblect is eligible for Serialization.
  4. In every Wrapper class , these three methods : toString(), hashcode() and equals () method are overridden..
Facebook Comments

Check Your Domain Ranking

Leave a Reply

Your email address will not be published. Required fields are marked *

ITSourceCode.com © 2016 Frontier Theme

Subscribe For Latest Updates

Signup for our newsletter and get notified when we publish new articles for free!