In this Example, We will Introduced you about the charValue() method of the character class.
Example For charValue() method in java
In this Example, We will Introduced you about the charValue() method of the character class. This method returns the Value of the character object. This method is used with the character object followed by .(dot) operator.
Example: CharacterValue.java
package com.devmanuals; public class Charactervalue { public static void main(String[] args) { Character ch1 = new Character('A'); Character ch2 = new Character('B'); System.out.print("The character value of ch1 is= "); System.out.println(ch1.charValue()); System.out.print("The character value of ch2 is= "); System.out.println(ch2.charValue()); } }
Output:
The character value of ch1 is= A The character value of ch2 is= B |
[ 0 ] Comments