1

Text Blocks, Locales, Numbers, and Math

This chapter includes 37 problems covering 4 main topics: text blocks, locales, numbers, and mathematical operations. We will start with text blocks (elegant multiline strings introduced in JDK 13 (JEP 355, preview)/ JDK 15 (JEP 378, final)), continue with problems for creating a Java Locale, including localized locales (JDK 19’s ofLocalizedPattern()), and finish with problems about numbers and math, such as the Babylonian method for computing the square root and different corner cases of results overflows. The last part of the chapter is dedicated to JDK 17’s (JEP 356, final) new API for pseudo-random generators.

By the end of this chapter, you’ll be up to date with all the new and cool JDK features ...

Get Java Coding Problems - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.