Compaq Placement Paper For Freshers Part-2
11) What are the disadvantages of threads?
The main disadvantage of using thread is that it is operating system dependent. It require to follow CPU cycle that various from system to system.
12) Why is java case sensitive?
Java is platform independent language. It is widely used for developing code which contains different variables and hence java is case sensitive.
13) What is singleton class?
A class which can create a single object at a time is called class. The object is accessible by the java virtual machine. It creates a single instance for the class
14) Objects are passed by value or by reference?
In java objects are passed by value. Since, the object reference value is passed both the original and the copied parameter will refer to the same object.
15) What is serialization?
It is a method which saves the object state by converting to byte stream.
16) What is externalizable interface?
Externalizable interface controls the serialization mechanism. It consist of two methods readexternal and writeexternal. It helps to customize the serialization process.
17) What are the different types of inner classes?
* Member classes.
* Anonymous classes.
* Nested top-level classes.
* Local classes.
18) What are wrapper classes?
Wrapper class represents a base class for the data source. It allows the primitive datatype to be accessed as objects.
19) What are the different ways to handle exception?
* By placing the desired code in the try block and allow the catch block to catch the exception.
* Desired exception can be placed in throw clause.
20) Is it necessary that each try block must be followed by a catch block?
It is not essential that try block should be followed by catch block.