int a = 999999999;
long b=999999999;
This gives no error.
But when I use long b=9999999999;
It gives error. Why ?
In video, it was told that long is greater than int.
Instructor
Ashish Thakur Replied on 23/08/2019
By default the value is picked up as int even for a long type variable.
Please go through the below code for better understanding of int and long
public static void main(String[] args) {
int a;
long b;
a = 2147483647;
b = Long.valueOf(a) * Long.valueOf(a);
System.out.println(a);
System.out.println(b);
}
Thanks.
Got my answer.