According to every reference I’ve ever found, the long type in Java ranges from -9,223,372,036,854,775,808 to +9,223,372,036,854,775,807.
I’ve written the following code below,
public static void main(String[] args){
long x = 12 * 24 * 60 * 1000 * 1000;
long y = 12 * 60 * 1000 * 1000;
System.out.print(x / y);
}
The expected result is 24; But the output was 0.
Your literals are int’s…
And that gives that x = 100130816 instead of 17280000000
Here you go:
The result is 24
P.S. i solved this the first time, but you deleted the Question…