Java Dynamic Cast
- How do you perform a dynamic cast using a Class cast type object instead of the static cast operator?
Answer: Java 5 has a new method called Class.cast. This is the dynamic equivalent of the cast operator in Java.
- When would you use the ConcurrentHashMap class?
Answer:
The java.util.ConcurrentHashMap is a collection that works much like the other collections except it provides concurrency support.
- What is an "instance method"?
Answer:
This is the method that the object contains.
- Is the Inputstream a class or an interface?
Answer:
A class Public class DataInputStream extends FilterInputStream implements DatInput
- What is one of the applications of a finally block?
Answer:
A finally block is used to guarantee that input stream and output stream will be closed even if an error occurs.
- When should you use byte streams?
Answer:
When dealing with the most primitive input and output operations.
- What purpose does the keyword "transient" serve?
Answer:
The transient keyword in the Java language is used for Java Serialization. Any field marked transient will not be saved to disk. This is useful when a class contains a reference to another object that does not implement Serializable but you still would like to persist a class instance to disk.
- What is serialization in Java?
Answer:
One approach to saving a data model to disk is to write all of the object instances in the data model's object graph to disk, and then simply reload them at a later time. Deserializing an object is the process of reconstructing the object instance from the data members written to disk.
- What is the readResolve() method in Java?
Answer:
The accessibility of the readResolve method is significant. If you place a readResolve method on a non-final class you must carefully consider its accessibility.
- What do all array types implement?
Answer:
All array types implement the cloneable interface. Any array can be copied by invoking its clone() method.