ByteBrawl - Importing A Package - Packages - Encapsulation

Packages - Importing A Package

Importing Packages

Before we get back to MyClass, let's start by importing a package that comes with Java. In fact, Java has many built-in packages that provide useful functionality. Many Java packages are already imported by default, but for some you need to manually import them when you need them. For this, you need to use the import keyword to access its classes. Let's try the ArrayList class from the java.util package:

You can see that this class proivdes an array with a dynamic length rather than fixed, which might be very useful for certain applications.