This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: name as the package Ie. The physical setup must match the logical o Unless declared private, classes, methods, and variables are accessible to all code in the package i.e have package visibility or “package scope” o To access public classes, methods, and variables in another package, you can: Use the fully qualified name Eg: Geometry.Point myPoint; Import part or all of a package, and use the simple name eg: import Geometry.*; ... Point myPoint; o The use of packages solves most naming conflicts A package creates a unique namespace Two or more classes can have the same name if they belong to different packages • i.e. are in different namespaces java.lang.Point and java.util.Point can both exist If no package declaration is used, an “unnamed package” is used by default READINGS AND EXERCISES Sections 8.2 and 5.4...
View Full Document
This note was uploaded on 11/04/2010 for the course CPSC 233 taught by Professor Li during the Fall '09 term at University of Calgary.
- Fall '09