150 CHAPTER 5: Introduction to Java: Objects, Methods, Classes, and Interfaces
This is basically to address where the code for each import statement is located. Here is a
generalization of how an import statement follows a path to the class:
import platform.functionality.classname;
The Android Bundle class import statement tells us the following information about the Bundle
Java class:
android indicates that this is an Android OS development package.
os refers to the operating system utilities functionality inside of this android.os
package.
Bundle refers to the proper name of the class that we intend on using, or
sub-classing.
Thus, the Activity class, which is the superclass for any Android Activity that you create, is found
within the android.app package. This .app part says that this package logically contains classes that
are necessary for the creation of Android applications, and one of these is the Activity class, which
allows us to define UI designs. The Bundle class, which allows us to bundle together application
variables into custom Bundle Objects, is kept in a different package for OS utilities as Bundle
Objects can be used in any area of Android, not just Activity.
The API
You might be wondering if the package is the highest level of organization in Java. The answer
is actually no, there is one even higher level, which is as you might imagine a collection of these
packages themselves! This level is sometimes called the platform or application programming
interface (API) level. An API for any given programming platform, like Android or Java, is a collection
of all of the packages for that given language.
Thus, there is a separate API for Java SE, Java EE, and Java ME, containing all the packages for
each specialized platform’s implementation, as well as an Android API, such as you are using in your
Hello Universe application currently. Android 4.4.4 KitKat API Level 19 is the 19th Android platform
to be released so far, and Android 5.0 “L” API Level 20 is the first 64-bit version of Android, and the
20th Android platform, and will be released sometime during the fourth quarter of 2014.
For this reason, if you want to develop applications using any given programming language, you
must go and get (and eventually learn) the API for that programming language in order to be able to
develop an application using its API, which is simply a collection of all of that language’s classes,
methods, and interfaces, which have been logically grouped in packages. You’ll essentially be
learning about core classes used in API during the course of this book.
Modifiers: Data Type, Access, Inheritance
Java uses strategic keywords prefacing, or in front of, its major constructs, which include: variables,
methods, and classes. These are also used in front of more specialized Java constructs, such as
public interfaces or constructor methods, all of which we’ve been learning about in this chapter.