Posts

Showing posts with the label Number Class

Java Number Class

Image
In this article we are reading about  “ Java Number Class ” . Java Number class is an  abstract  class which is placed in  java.lang  package. It has  four  abstract methods and two  concrete methods. The abstract class Number is the superclass of classes BigDecimal, BigInteger, Byte, Double, Float, Integer, Long, and Short. This class contains a single consructor  number() . In Java language, we mostly work with a  primitive data type , but Java also provides a  wrapper class  under the abstract class numbers in java.lang package, there are six subclasses under the class ‘numbers’. The primitive data types are ‘wrapped’ under these Java classes for their corresponding objects. This wrapping is usually done by the compiler. When an object is converted into primitive type than it is called Autoboxing, and then again transferred to an object it is called Unboxing. The following figure shows the class hier...