Chapter 16Exceptions, Assertions, and Localization

OCP EXAM OBJECTIVES COVERED IN THIS CHAPTER:

  • Exception Handling and Assertions
    • Use the try‐with‐resources construct
    • Create and use custom exception classes
    • Test invariants by using assertions
  • Localization
    • Use the Locale class
    • Use resource bundles
    • Format messages, dates, and numbers with Java

This chapter is about creating applications that adapt to change. What happens if a user enters invalid data on a web page, or our connection to a database goes down in the middle of a sale? How do we ensure rules about our data are enforced? Finally, how do we build applications that can support multiple languages or geographic regions?

In this chapter, we will discuss these problems and solutions ...

Get OCP Oracle Certified Professional Java SE 11 Developer Complete Study Guide now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.