Java Convert long to 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);
}
}
long value: 88
char value: X
Happy Coding 😊