Beginners of Java often ask why we need to use the suffix l or L, because even without it, such as in the following, the program still compiles.
long a = 123;
This is only partly true. An integer literal without a suffix L or l is regarded as an int. Therefore, the following will generate a compile error because 9876543210 is larger than the capacity for an int:
- Chapter 2: Language Fundamentals
- from Java: A Beginner’s Tutorial, 4th Edition (Updated for Java SE 8)
- Publisher: Brainy Software
- Released: January 2015
The quistioin is not fully answered. why not to just use long a = 54613548; without adding l or L at the end?
Share this highlighthttp://www.safaribooksonline.com/a/java-a-beginners/15208188/