Answer the question
In order to leave comments, you need to log in
Why is it showing as an error?
public class Solution
{
public static void main(String[] args) throws Exception
{
long l = 2147483648;
int r = (int) l;
System.out.println(r);
}
}
Answer the question
In order to leave comments, you need to log in
Потому, что по-умолчанию этот литерал воспринимается как int. Поэтому надо писать так
long l = 2147483648L;
int r = (int) l;
System.out.println(r);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question