|
1. What is a package? A package is a collection of classes and interfaces that provides a high-level layer of access protection and name space management. 2. What is method overloading and method overriding? Method overloading : When a method in a class having the same method name with different arguments is said to be method overloading. Method overriding : When a method in a class having the same method name with same arguments is said to be method overriding. 3. Why a java program can not directly communicate with an ODBC driver? Since ODBC API is written in C language and makes use of pointers which Java can not support. 4. Can you have virtual functions in Java? Yes or No. If yes, then what are virtual functions ? Yes, Java class functions are virtual by default. Virtual functions are functions of subclasses that can be invoked from a reference to their superclass. In other words, the functions of the actual object are called when a function is invoked on the reference to that object. 5. In Java, what is the difference between an Interface and an Abstract class ? An Abstract class declares have at least one instance method that is declared abstract which will be implemented by the subclasses. An abstract class can have instance methods that implement a default behavior. An Interface can only declare constants and instance methods, but cannot implement default behavior. 6. What is the purpose of garbage collection in Java, and when is it used ? The purpose of garbage collection is to identify and discard objects that are no longer needed by a program so that their resources can be reclaimed and reused. A Java object is subject to garbage collection when it becomes unreachable to the program in which it is used. 7. What is an abstract class ? An abstract class is a class designed with implementation gaps for subclasses to fill in and is deliberately incomplete. 8. Name some of the classes which provide the functionality of collation ? collator, rulebased collator, collationkey, collationelement iterator. 9. What are mutex and semaphore? What is the difference between them ? A mutex is a synchronization object that allows only one process or thread to access a critical code block. A semaphore on the other hand allows one or more processes or threads to access a critial code block. A semaphore is a multiple mutex. 10. Describe synchronization in respect to multithreading With respect to multithreading, synchronization is the capability to control the access of multiple threads to shared resources. Without synchonization, it is possible for one thread to modify a shared variable while another thread is in the process of using or updating same shared variable. This usually leads to significant errors.
|