public static void main(String[] args) { final int a =15; byte b = a; System.out.println(a); System.out.println(b); }
In the above code, when I convert from int to byte, it does not give a compile-time error, but when my conversion is from long to int, it gives a compile-time error, WHY?
public static void main(String[] args) { final long a =15; int b = a; System.out.println(a); System.out.println(b); }
java
Shashank agarwal
source share