packages and the import statement

packages and the import statement - Packages In the...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Packages In the previous lecture, we used the class name javax.swing.JFrame . In this little lecture, we show how it can be abbreviated as JFrame . In Java, a package is a collection of classes that reside in the same directory on your hard drive. In our file- cabinet analogy, think of a package as a room that contains file cabinets with one drawer for each class. The package is Java’s way of organizing a large collection of classes —Java version 6 comes with over 3775 classes, organized into about 200 packages. Here are four of the packages. package java.io classes dealing with input/output package java.net classes dealing with the internet package java.awt classes dealing with GUIs package javax.swing newer classes dealing with GUIs These package names act as paths on your hard drive. From the above package names, we can see that there are two main directories, java and javax , and within directory java , there are directories io , net , and awt . Below, we show this directory structure, giving a few classes that are in directory
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 2

packages and the import statement - Packages In the...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online