Skip to content

Tag Archives: java-wrapper-class

Wrapper Class a class whose object wraps or contains primitive data types. When we create an object to a wrapper class, it contains a field… Read More
Firstly the question that hits the programmers is when we have primitive data types then why does there arise a need for the concept of… Read More
Java provides the Comparable interface to sort objects using data members of the class. The Comparable interface contains only one method compareTo() that compares two… Read More
Prerequisite – Autoboxing and unboxing in Java 1)What is the output of the following program? class Main {     public static void main(String[] args)     {         Double… Read More
In Java, int is a primitive data type while Integer is a Wrapper class. int, being a primitive data type has got less flexibility. We… Read More
Given a number in a given base, convert it into another target base.Examples   Input : Number = "123" Source Base = 8 Target Base =… Read More
Long class is a wrapper class for the primitive type long which contains several methods to effectively deal with a long value like converting it… Read More
Integer class is a wrapper class for the primitive type int which contains several methods to effectively deal with an int value like converting it… Read More
Short class is a wrapper class for the primitive type short which contains several methods to effectively deal with a short value like converting it… Read More
Byte class is a wrapper class for the primitive type byte which contains several methods to effectively deal with a byte value like converting it… Read More
Double class is a wrapper class for the primitive type double which contains several methods to effectively deal with a double value like converting it… Read More
Float class is a wrapper class for the primitive type float which contains several methods to effectively deal with a float value like converting it… Read More
Java provides a wrapper class Boolean in java.lang package. The Boolean class wraps a value of the primitive type boolean in an object. An object… Read More
Autoboxing: Converting a primitive value into an object of the corresponding wrapper class is called autoboxing. For example, converting int to Integer class. The Java… Read More
Most of the time, while working with numbers in java, we use primitive data types. But, Java also provides various numeric wrapper sub classes under… Read More