This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
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


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "integer literals" Watch "integer literals" New topic
Author

integer literals

kambiz shahri
Greenhorn

Joined: Oct 29, 2007
Posts: 3
Hi

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.

regards
k
Jim Yingst
Wanderer
Sheriff

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’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: integer literals
 
jQuery in Action, 3rd edition