A temporary change of type

The code in Listing 6 uses a cast operator to temporarily change the type of data in a variable of type char to type short.

The symbol for the cast operator used in Listing 6 is: (short)

As a result, the insertion operator will treat it as type short and display the numeric value instead of the character represented by the numeric value.

The output produced by the code in Listing 6 is shown in Figure 4.

The cast operator
  Display as type char: A
  Display as type short: 65
Figure 4