Join David Gassner for an in-depth discussion in this video Using underscores in numeric literals, part of Java Advanced Training.
Here's another new feature of Java 7 that isn't earth-shattering, that can save you some time.…Long numeric literals can be hard to read in your code.…To demonstrate this, I'll start in this class named NumericLiteralDemo.…Within the main method, I'll declare an integer value named numberOfOlives and set it to 1,000,000.…I'll use the digits 1-0-0-0-0-0-0. Now, this code is certainly correct.…
And if I try to do something with this numeric value, it will work, but here's the challenge.…I'll save and close this class, and now let's imagine a week going by, and then I'll come…back, and I'll open the class again, and I'll stare at this number, and think, I'm not quite…sure how much that is.…And I'll have to manually count backward, and therefore it's one million.…Up through Java 6 that was what you had to do.…But in Java 7, you can now add underscores as thousand separators or for any other annotation…you want to use in your numeric literals.…
So, once again, I'll start at the back of the value, and then I'll count forward adding…
- Installing Java on Windows and Mac OS X
- Installing Eclipse
- Using new features such as simplified generics
- Working with advanced class structures (member, local inner, etc.)
- Using the Reflection API
- Navigating inheritance trees
- Managing unordered and ordered sets
- Peeking and polling with queues
- Testing and error handling
- Managing files and directories
- Working with I/O streams
- Next steps with Java
Skill Level Advanced
1. Getting Started
2. Java 7 New Features
3. Using Advanced Class Structures
4. Using the Reflection API
5. More of the Collections Framework
6. Testing and Advanced Exception Handling
Using the finally keyword5m 40s
7. Managing Files and Directories in Java 7
8. Working with I/O Streams
9. Working with Multi-threading
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.