Set - 3

Question 16 :

How do you know if an explicit object casting is needed?

Answer :

If you assign a superclass object to a variable of a subclass's data type, you need to do explicit casting. For example:

Object a; Customer b; b = (Customer) a;

When you assign a subclass to a variable having a supeclass type, the casting is performed automatically.

Question 17 :

What is a Java package and how is it used?

Answer :

A Java package is a naming context for classes and interfaces. A package is used to create a separate name space for groups of classes and interfaces. Packages are also used to organize related classes and interfaces into a single API unit and to control accessibility to these classes and interfaces.

Question 18 :

How do you restrict a user to cut and paste from the html page?

Answer :

Using Servlet or client side scripts to lock keyboard keys. It is one of solutions.

Question 19 :

What are the Object and Class classes used for?

Answer :

The Object class is the highest-level class in the Java class hierarchy. The Class class is used to represent the classes and interfaces that are loaded by a Java program.

Question 20 :

What is Serialization and deserialization ?

Answer :

Serialization is the process of writing the state of an object to a byte stream. Deserialization is the process of restoring these objects.