Java Reference
In-Depth Information
Answers
1. b. The bracket indicates the depth of the array, the L indicates that it is an array of
objects, and the class name that follows is self-explanatory.
2. a. Persistence saves objects to disk or another storage medium via serialization so
they can be recreated later.
3. b. If the class is not found, a ClassNotFoundException is thrown.
Certification Practice
The following question is the kind of thing you could expect to be asked on a Java pro-
gramming certification test. Answer it without looking at today's material or using the
Java compiler to test the code.
16
Given:
public class ClassType {
public static void main(String[] arguments) {
Class c = String.class;
try {
Object o = c.newInstance();
if (o instanceof String)
System.out.println(“True”);
else
System.out.println(“False”);
} catch (Exception e) {
System.out.println(“Error”);
}
}
}
What will be the output of this application?
a. True
b. False
c. Error
d. The program will not compile.
The answer is available on the topic's website at http://www.java21days.com. Visit the
Day 16 page and click the Certification Practice link.
Search WWH ::




Custom Search