Java-Primitive Wrapper Classes to Primitive Type Using typeValue Method

Primitive Wrapper Classes to Primitive Type Using typeValue Method

Method Calling Conversion Action
char c = Character.charValue(); Object to primitive character
int i = Integer.intValue(); Object to primitive integer
float f = Float.floatValue(); Object to primitive float
long l = Long.longValue(); Object to primitive long
double d = Double.doubleValue(); Object to primitive double

Program

0

Program Source

public class Javaapp {

    public static void main(String[] args) {
        
        Integer data1 = new Integer(250);
        Character data2 = new Character('Q');
        
        int da  = data1.intValue();
        char ch = data2.charValue();
        
        System.out.println("da = "+da);
        System.out.println("ch = "+ch); 
    }
}

Leave a Comment