lecture34 - COMP 250 Winter 2010 34 - modifiers April 12,...

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

View Full Document Right Arrow Icon

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

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

Unformatted text preview: COMP 250 Winter 2010 34 - modifiers April 12, 2010 Java modifiers [Note: some of this is taken from the Readings BackgroundJava.pdf which I posted early in the course. I have added further details that involve concepts from inheritance.] Packages A package is a particular set of classes. Go to the Java API http://java.sun.com/j2se/1.5.0/docs/api/ . and notice that in the upper left corner of that page is a listing of dozens of packages. A few of them that you are familiar with are: java.lang - Object, String, Math, ... java.util- has many of the data structure classes that we will use in this course, such as LinkedList , ArrayList , HashMap The full name of a class is the name of the package following by the name of the class, for ex- ample java.lang.Object or java.util.LinkedList . You can have packages within packages e.g. java.lang is a package within the java package. You can also make your own packages, of course. For example, the classes Beagle and Dog might belong to package comp250.lectureExamples , and so the full name of the classes would be comp250.lectureExamples.Beagle and comp250.lectureExamples.Dog . A package has a tree structure. Packages are directories, typically internal nodes 1 ). The classes within a package are leaves. [ASIDE: The issue of how file systems and packages are organized is important in practice, but I did not discuss it in class. If you want to learn about package trees and how they correspond to file directories (and to www URLs) then you read through the following: http://cs.armstrong.edu/liang/intro6e/supplement/packages.pdf ] When you are writing a class and you want to identify the class as being part of a particular package, you start the class with the package name. The first line of your class file will be package PackageName...
View Full Document

This note was uploaded on 09/25/2011 for the course COMP 250 taught by Professor Blanchette during the Spring '08 term at McGill.

Page1 / 4

lecture34 - COMP 250 Winter 2010 34 - modifiers April 12,...

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