Cast back to short in Java
Description
The following code shows how to cast back to short.
Example
//from w ww. j av a 2 s .c o m
public class Main {
public static void main(String[] args) {
short a, b, c;
c = 2;
b = 9;
a = (short) (b + c);
System.out.println("a is " + a);
}
}
The code above generates the following result.
Home »
Java Tutorial »
Java Data Type »
Java Tutorial »
Java Data Type »