Java Reference
In-Depth Information
Lines 19-23 loop through the array of Class objects that represents the arguments asso-
ciated with a method. The name of each argument is added to a StringBuffer object
named params in line 22.
Reflection is most commonly used By using reflectionby tools such as class browsers
and debuggers as a way to learn more about the class of objects being browsed or
debugged.
Reflection also is needed with JavaBeans, a technique for creating
Java classes that can be manipulated in a programming environ-
ment. These classes, called beans , enable Java applications to be
created by loading beans into an interface, customizing them, and
controlling their interactions.
NOTE
16
Summary
Although Java has always been a network-centric language, the topics covered today
show how the language has been extended in new directions.
Object serialization shows how objects created with Java have a life span beyond that of
a Java program. You can create objects in a program that are saved to a storage device
such as a hard drive and re-created later after the original program has ceased to run.
Object persistence is an effective way to save elements of a program for later use.
Q&A
Q Are object streams associated with the Writer and Reader classes that are used
to work with character streams?
A The ObjectInputStream and ObjectOutputStream classes are independent of the
byte stream and character stream superclasses in the java.io package, although
they contain many of the same methods as the byte classes.
There shouldn't be a need to use Writer or Reader classes in conjunction with
object streams because you can accomplish the same things via the object stream
classes and their superclasses ( InputStream and OutputStream ).
 
 
Search WWH ::




Custom Search