Character charValue() in Java

charValue(): This method is available in java.lang.Character class of Java.

Syntax:

char java.lang.Character.charValue()

This method returns the value of this Character object.

Parameters: NA

Returns: the primitive char value represented by this object.

Exceptions: NA

Approach

Java

public class CharactercharValue {
    public static void main(String[] args) {

        Character c = 'a';

        System.out.println(c.charValue());
    }
}

Output:

a

No comments:

Post a Comment