Data type conversion of the cast

Second, the cast
1. Features : format code requires special processing, not automatically.

2. Rules : descending data range .
3. Format : Small small type of variable name = range (small type) had a large range of data ;

Cast codes :

. 1  public  class Demo02DataType {
 2      public  static  void main (String [] args) {
 . 3          // left int type, the right type long, not the same
 . 4          // long -> int, not small to large
 5          // not occur automatic conversion!
6          // Format: Small small type of variable name = range (small type) had a large range of data; 
. 7          int NUM = ( int ) 100L ;
 . 8          System.out.println (NUM);
 . 9 }

Output:

  100

Guess you like

Origin www.cnblogs.com/chenliqiang/p/11441872.html