Number class Methods in Java

java.lang.Number

The abstract class Number is the superclass of platform classes representing numeric values that are convertible to the primitive types byte, double, float, int, long, and short.


Some methods of Number class


byteValue()It returns the value of the specified number as a byte. 


doubleValue()It returns the value of the specified number as a double.


equals()It indicates whether some other object is "equal to" this one.


floatValue()It returns the value of the specified number as a float.


hashCode()It returns a hash code value for the object.


intValue()It returns the value of the specified number as an int.


longValue()It returns the value of the specified number as a long.


shortValue()It returns the value of the specified number as a short. 


toString(): It returns a string representation of the object.



No comments:

Post a Comment