Java Reference
In-Depth Information
E5. Write (and test) a procedure that compares two text files (which are obtained
from the user). For each line i for which they differ, print the line number and the
two lines.
E6. Write (and test) a procedure that (1) obtains the name of an output file from
the user and (2) writes the first 50 squares on that output file, one on each line.
E7. Write (and test) a procedure that (1) obtains the name of an input file from
the user, say the name is "xxx" , (2) reads the file into a Vector , and (3) produces
an output file named "outxxx" that contains the lines of the input file but in
reverse order.
E8. Write (and test) a procedure that (1) obtains the name of a file that is to be
appended to (not simply overwritten) and appends a line containing "THIS WAS
APPENDED" to it.
Universal resource locators
URL stands for uniform resource locator . URLs are used on the internet to define
files and the protocols with which they should be processed. Here is an example
of a URL:
In this section, we describe URLs, look at a class in the API package whose
instances maintain URLs, and show how to read the file given by a URL.
consists of
1. An identification of a service or protocol (e.g. http );
2. A domain name or host (, which is associated with a
computer that is attached to the internet; and
3. A path on that computer (Courses/cs211/2001fa/index.html).
A URL can have other components, Here, we discuss only a restricted form
of URL, which can be given as follows:
< protocol >://< domain-name >< path >?< query >#< fragment >
Here are the protocols one usually sees:
1. http : This stands for HyperText Transport Protocol , which is the most-
Search WWH ::

Custom Search