Reputation: 701
I tried the following code.
System.out.println(new Date(1268234290000));
It throws Exception
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The literal 1268234290000 of type int is out of range
How to resolve?
Upvotes: 2
Views: 283
Reputation: 122018
Since it's a long value append L
System.out.println(new Date(1268234290000L));
An integer literal is of type long if it is suffixed with an ASCII letter L or l (ell); otherwise it is of type int (§4.2.1).
Upvotes: 7