1.3. Java packages

[1.4] Import other Java packages to make them accessible in your code

This exam covers importing packages into other classes. But with more than a decade and a half of experience, I’ve learned that before starting to import other packages into your own code, it’s important to understand what packages are, the difference between classes that are defined in a package and the classes that aren’t defined in a package, and why you need to import packages in your code.

In this section, you’ll learn what Java packages are and how to create them. You’ll use the import statement, which enables you to use simple names for classes and interfaces defined in separate packages.

1.3.1. The need for packages

Why do you ...

Get OCA Java SE 8 Programmer I Certification Guide 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.