File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes integer literals Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "integer literals" Watch "integer literals" New topic

integer literals

kambiz shahri

Joined: Oct 29, 2007
Posts: 3

For the longest time i had assumed that integer literals defaulted to Long and floting point literals to Double.
Now i find out that actually integer literals default to int.
Am i going insane...where does the default to Long type come in....i've been a java programmer for a long long time.

Jim Yingst

Joined: Jan 30, 2000
Posts: 18671
Never. There is no default to long. If you want a long literal, put "L" at the end of the number.

"I'm not back." - Bill Harding, Twister
I agree. Here's the link:
subject: integer literals
It's not a secret anymore!