Java Convert long to char

Tags: long char

In this Java core tutorial we learn how to convert a long value into char value in Java programming language.

How to convert long to char in Java

In Java, with a given long value we can cast it to char as the following example Java code.

ConvertLongToCharExample1.java

public class ConvertLongToCharExample1 {
    public static void main(String... args) {
        long longValue = 88;

        // Convert long to char
        char charValue = (char)longValue;

        System.out.println("long value: " + longValue);
        System.out.println("char value: " + charValue);
    }
}
The output as below.
long value: 88
char value: X

Happy Coding 😊

Java Convert byte to long

Java Convert char to long

Java Convert long to byte