Week 2

Table of Contents

Primitive Data Types in Java
Operators in Java
Classes and the Math Class
Packages in Java
Variable Scope in Java
Looping Structures in Java
Conditional Structures in Java

Packages and Java

Packages are a collection of related classes.  These packages are gathered together to attempt to avoid conflicts between classes.  There are two categories of classes: Built-in packages and User-Defined packages.

Built-In Packages

These are packages that are included in the Java Development Environment (JDE) and are free to use in your applications.  The math class is included in the java.lang package.

More information on W3Schools.

Standard Packages

Frequently Used Standard Packages

Package Name Description
java.long Classes that support the basic language features and the handling of arrays and strings.  Classes in this package are always directly in your programs by default because this package is always automatically loaded with your program.
java.io Classes for stream input and output operations.
java.nio.file Classes for file input and output.
java.util Utility classes of various kinds, including classes for managing data within collections or groups of data items.
javax.swing These classes of various kinds, including classes for managing data within collections or groups of data items.
java.awt Classes in this package provide the original GUI components (DJK 1.1) as well as some basic support necessary for Swing components.
java.awt.geom These classes define two-dimensional geometric shapes
java.awt.event The classes in this package are used in the implementation of windowed applications to handle events in your program.  Events are things such as moving the mouse, pressing the left mouse button, or clicking on a menu item.