![]() |
Working With Class Information
PrerequisitesIn Java, a considerable amount of information about classes can be obtained at runtime, this sort of information is often referred to as meta information. In particular, given an Object, it is always possible to figure out what Class it belongs to. In this Magercise, the methods Object.getClass and Class.getName will be used in the Company class to tally the total value of all contracts held with individuals.More information on these, and other useful meta-related methods, can be seen by looking at the JDK reference for Object and Class. Note that some of the methods can throw exceptions. One of the exception Magercises shows how to safely use them. More information on class methods is covered in the course notes. Work LocationPerform all work for this magercise in VisualAge project MageLang Magercises, package magercises.meta. If this project does not appear in your Workspace add it from the repository (if it exists there) or create a new project using this name. Tasks
Perform the following tasks:
|
Copyright © 1996-1997 MageLang Institute. All Rights Reserved. |