September 2005
Beginner
576 pages
13h 6m
English
For this hour's workshop, you will create a class that uses exceptions to tell another class about an error that has taken place.
The classes in this workshop are HomePage, a class that represents a personal home page on the World Wide Web, and PageCatalog, an application that catalogs these pages.
Enter the text of Listing 18.4 in your text editor, saving it as HomePage.java when you're done.
1: import java.net.*; 2: 3: public class HomePage { 4: String owner; 5: URL address; 6: String category = "none"; 7: 8: public HomePage(String inOwner, String inAddress) 9: throws MalformedURLException { 10: 11: owner = inOwner; 12: address = new URL(inAddress); 13: ... |
Read now
Unlock full access