15 lines
375 B
Java
15 lines
375 B
Java
|
//: operators/Casting.java
|
|||
|
// <20>2015 MindView LLC: see Copyright.txt
|
|||
|
|
|||
|
public class Casting {
|
|||
|
public static void main(String[] args) {
|
|||
|
int i = 200;
|
|||
|
long lng = (long)i;
|
|||
|
lng = i; // "Widening," so cast not really required
|
|||
|
long lng2 = (long)200;
|
|||
|
lng2 = 200;
|
|||
|
// A "narrowing conversion":
|
|||
|
i = (int)lng2; // Cast required
|
|||
|
}
|
|||
|
} /* Output: (None) *///:~
|