Start of Tutorial > Start of Trail > Start of Lesson |
Search
Feedback Form |
1. Assume that you have written some classes. Belatedly, you decide that they should be split into three packages, as listed in the table below. Furthermore, assume that the classes are currently in the default package (they have nopackage
statements).
Package Name
Class Name
mygame.server
Server
mygame.shared
Utilities
mygame.client
Client
a. What line of code will you need to add to each source file to put each class in the right package?
b. To adhere to the directory structure, you will need to create some subdirectories in your development directory, and put source files in the correct subdirectories. What subdirectories must you create? Which subdirectory does each source file go in?
c. Do you think you'll need to make any other changes to the source files to make them compile correctly? If so, what?
1. Download the source files pointed to by this page.Check your answers.a. Implement the changes you proposed in question 1, using the source files you just downloaded.b. Compile the revised source files. (Hint: If you're invoking the compiler from the command line (as opposed to using a builder), invoke the compiler from the directory that contains the
mygame
directory you just created.)
Start of Tutorial > Start of Trail > Start of Lesson |
Search
Feedback Form |
Copyright 1995-2004 Sun Microsystems, Inc. All rights reserved.