Tutorial #10 : Number

The object of the wrapper class contains or wraps its respective primitive data type. Converting primitive data types into object is called boxing, and this is taken care by the compiler. Therefore, while using a wrapper class you just need to pass the value of the primitive data type to the constructor of the Wrapper class. The Number class is part of the java.lang package.


For example:

int i = 500;float gpa = 3.65f;byte mask = 0xff;

                          The class hierarchy of Number.

SNModifier & TypeMethodDescription
1)BytebyteValue()It converts the given number into a byte type and returns the value of the specified number as a byte.
2)abstract doubledoubleValue()It returns the value of the specified number as a double equivalent.
3)abstract floatfloatValue()It returns the float equivalent value of the specified Number object.
4)abstract intintValue()It returns the value of the specified number as an int.
5)abstract longlongValue()It returns the value of the specified number object as long equivalent.
6)shortshortValue()It returns the value of the specified number as a short type after a primitive conversion.


Comments

  1. As claimed by Stanford Medical, It's really the SINGLE reason women in this country get to live 10 years longer and weigh an average of 19 KG less than us.

    (By the way, it has absolutely NOTHING to do with genetics or some hard exercise and really, EVERYTHING to do with "how" they are eating.)

    P.S, What I said is "HOW", and not "what"...

    Click this link to find out if this brief test can help you decipher your real weight loss possibilities

    ReplyDelete

Post a Comment