Wrapper classes are the classes provided by java programing these can be use as data type , because it is a wrapper class, so it wrapped. The datatype and some associated method in a class.

There are 9 wrapper classes in Java

  • Short
  • Interger
  • Long
  • Float
  • Double
  • Character
  • Boolean
  • Byte
  • String

Integer

Method (Static)

  • parseInt() :- Converts other types value into int datatype.
  • valueOf() :- Converts other types value into integer type.

Long

Method (Static)

  • parseLong() :- Converts other types value into long datatype.
  • valueOf() :- Converts other types value into long type.

Character

Method (Static)

  • parseChar() :- Converts other types value into char datatype.
  • valueOf() :- Converts other types value into character type.

Float

Method (Static)

  • parse() :- Converts other types value into float datatype.
  • valueOf() :- Converts other types value into float type.

Boolean

Method (Static)

  • parseBool() :- Converts other types value into bool datatype.
  • valueOf() :- Converts other types value into boolean datatype.

Double

Method (Static)

  • parseDouble() :- Converts other types value into double datatype.
  • valueOf() :- Converts other types value into double datatype.

Byte

Method (Static)

  • parseByte() :- Converts other types value into byte datatype.
  • valueOf() :- Converts other types value into byte datatype.

Example

public class wra {
     
        public static void main(String[] args) { 
          Integer a = 25; 
          Double b = 25.36; 
          Character c = 's'; 
          System.out.println(a);
          System.out.println(b);
          System.out.println(c);
        }
    
}
Example

Let’s run the code

Input Value
Output Value

System:-  It is class defined within java.lang package that permots input  and output.

Out:- It is pre-defined static object of system class used for displaying message or value of variables.

Methods of out object

Print():-  This method displaying the message and value of variables in current line.

Escape sequence character are allowed

  • \n = new line      
  • \t = tab space
  • + = string concatenation

Println():-  This is similar like print() but unlike print(), It creates new line after displaying the message or value.

If you have any queries regarding this article or if I have missed something on this topic, please feel free to add in the comment down below for the audience. See you guys in another article.

To know more about JAVA Wikipedia please click here .

Stay Connected Stay Safe, Thank you


Basic Engineer

Hey Readers! We have more than fifteen years of experience in Software Development, IoT, Telecom, Banking, Finance and Embedded domain. Currently we are actively working on Data Science, ML and AI with multiple market leaders worldwide. Happy Reading. Cheers!

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *