CHAPTER 10

Commonly Used Classes from the java.lang Package

As seen in Chapter 9, there are various packages available as part of the Java API. One of the basic packages is the java.lang package. This package contains the core classes and interfaces used in the Java Language. These include classes and interfaces like System, String, StringBuffer, StringBuilder, CharSequence, Comparable, Math and the Wrapper classes. In this chapter we discuss some of these classes and interfaces and their common usages.

10.1 Comparable AND Comparator INTERFACES

We saw in Chapter 3 that the relational operators < > <= >= work only for numeric data types, i.e. the comparison is not available for reference data types. For boolean data types, it is very logical that ...

Get The class of Java 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.