Wrapper classes (Part-2) in Java

Remaining part of Wrapper class you can study from link:https://codingsmania.in/wrapper-classespart-1-in-java/

4. Byte Class Methods

Int CompareTo(Byte b): This method compares the value of Byte object with the value to ‘b’ argument and will return numerical values. If values are same then it will return ‘0’, if Byte object value is less than ‘b’ then will return some negative value otherwise returns positive value.

Boolean equals(Object b): This method will return true if Byte object have same value as object b, otherwise will return false.

Static byte parseByte(String s): This method will return valid byte value of string s.

Static Byte ValueOf(Byte b): This method will return an object of type Byte by converting it into value of b.

Short ShortValue(): This method will covert Byte object into short value of and return it.

Byte byteValue(): This method will return the byte value from Byte object. Int intValue(): This method will return an int value from the Byte object. long longValure(): This method will return a long value from Byte object. float floatValure(): This method will return a float value from Byte object.

Constructors:

Byte(byte b): This method will make a byte object and assign it with value of byte b argument.

Byte(String s): This method will make a Byte object and assign it with value represented by String s argument.

5. Double Class Methods

Boolean DoubleValue(): This method return double value of the double object.

Int compareTo(double b): This method compares the double object with double b . It will return numerical values. If values are same then return 0, if double object value is less then it return negative value otherwise positive value.

Boolean equal(object b): This method will return true if double object and object b have same values otherwise false.

Static Double parseDouble(String s): This method converts double value from string and return it.

Static Double ValueOf(double b): This method convert double object from value double b and return it.

Static Double ValueOf(String s): This method convert double object from String s and returns it.

Short ShortValue(): This method will covert Double object into short value of and return it.

Byte byteValue(): This method will return the byte value from Double object. Int intValue(): This method will return an int value from the Double object. long longValure(): This method will return a long value from Double object. float floatValue(): This method will return a float value from Double object.

Double doubleValue(): This method will return a double value from Double object.

Constructors:

Double(double d): This method will make a new double object and assign it with double ‘d’ augment.

Double (String s): This method will make a Double object and assign it with value represented by String s argument.

6. Long Class Methods

Boolean equal(object b): This method will return true if Long object and object b have same values otherwise false.

Int compareTo(longe b): This method compares the long object with long b value . It will return numerical values. If values are same then return 0, if long object value is less then it return negative value otherwise positive value.

Static long parseLong(String s): This method will return valid long value of string s.

Static long ValueOf(long b): This method convert long object from value of long b and return it.

Short ShortValue(): This method will covert long object into short value of and return it.

Long byteValue(): This method will return the byte value from Long object. Int intValue(): This method will return an int value from the Long object. long longValue(): This method will return a long value from Long object. float floatValure(): This method will return a float value from Long object.

Double doubleValue(): This method will return a double value from Long object

Constructors:

Long(long l): This method will make long object and assign it with value of long ‘l’ argument.

Long(String l): This method will make a long object and assign it with value represented by String s argument.

7. Short Class Methods

Int compareTo(longe b): This method compares the long object with long b value . It will return numerical values. If values are same then return 0, if long object value is less then it return negative value otherwise positive value.

Boolean equal(object b): This method will return true if Short object and object b have same values otherwise false.

Static Short parseShort(String s): This method will return valid short value of string s.

Static Short ValueOf(Short b): This method convert short object from value of short b and return it.

Static Short ValueOf(String s): This method convert short object from String s and returns it. Short ShortValue(): This method will covert long object into short value of and return it. byte byteValue(): This method will return the byte value from short object.

Int intValue(): This method will return an int value from the short object.

long longValue(): This method will return a long value from short object.

float floatValure(): This method will return a float value from short object.

Double doubleValue(): This method will return a double value from short object

Constructors:

Short(short v): This method will make a short object and initialize it with value short v.

Short(String s): This method will make a short object and assign it with value represented by String s argument.

Leave a Reply