Java convert char to short

Tags: char short

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

How to convert char to short in Java

In Java, with a given char value we can convert it to short by casting the char variable into a short variable as the following example Java program.

public class ConvertCharToShortExample1 {
    public static void main(String... args) {
        char charValue = 'A';

        short shortValue = (short)charValue;

        System.out.println("char value: " + charValue);
        System.out.println("short value: " + shortValue);
The output as below.
char value: A
short value: 65

Happy Coding 😊

Java convert short to long

Java convert short to byte

Java convert short to BigInteger

Java convert short to BigDecimal

Java convert short to char

Java convert long to short

Java convert byte to short