Java Reference
In-Depth Information
Character stream operations are provided by sub classes of the
Reader
and
Writer
classes.
❑
A nod is as good as a wink to a blind horse.
❑
Exercises
1.
Modify the
FormattedWriter
class to support centered output of the value in the output field.
2.
Use a
StreamTokenizer
object to parse a string entered from the keyboard containing a
series of data items separated by commas and output each of the items on a separate line.
3.
Create a class defining an object that will parse each line of input from the keyboard that
contains items separated by an arbitrary delimiter (for example, a colon, or a comma, or a
forward slash, etc.) and return the items as an array of type
String[]
. For example, the
input might be:
1/one/2/two
The output would be returned as an array of type
String[]
containing "1", "one", "2", "two".