catch (IllegalAccessException iae)
catch (InstantiationException ie)
System.err.println("Unable to instantiate loaded
Assumingthatyou'vecompiledallsourcefiles( javac *.java ,forexample),ex-
ecute java ViewerDemo EXE . You should observe the following output:
outputting EXE content in hexadecimal
If you were to execute java ViewerDemo PNG , you should see similar output.
Suppose you attempted to load and instantiate the abstract Viewer class via java
ViewerDemo "" . Although this class would load, newInstance() would throw
aninstanceofthe InstantiationException class,andyouwouldseethefollow-
Unable to instantiate loaded class
notations() methods reveal that each method returns an array of Annotation ,
aninterfacethatislocatedinthe java.lang.annotation package. Annotation
is the superinterface of Override , SuppressWarnings , and all other annotation
Table4-3 'smethoddescriptionsalsoreferto Constructor , Field ,and Method .
Instances oftheseclasses represent aclass's constructors andaclass's oraninterface's
fields and methods.
Constructor represents a constructor and is generically declared as Con-
structor<T> , where T identifies the class in which the constructor represented by