With respect to multithreading, synchronization is the capability to control the access of multiple threads to shared resources Without synchronization, it is possible for one thread to modify a shared object while another thread is in the process of using or updating that object's value This often leads to significant errors
Correct Answer: Pass By Reference means the passing the address itself rather than passing the value Passby Value means passing a copy of the value to be passed
3. What is the purpose of garbage collection in Java, and when is it used ?
Correct Answer: 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
4. What is the difference between an Interface and an Abstract class?
Correct Answer: 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 and all methods are implicitly abstract An interface has all public members and no implementation An abstract class is a class which may have the usual flavors of class members (private, protected, etc), but has some abstract methods
Correct Answer: No The JDBC-ODBC Bridge does not support multi threading The JDBC-ODBC Bridge uses synchronized methods to serialize all of the calls that it makes to ODBC Multi-threaded Java programs may use the Bridge, but they won't get the advantages of multi-threading
Correct Answer: The wait(), notify(), and notifyAll() methods are used to provide an efficient way for threads to wait for a shared resource When a thread executes an object's wait() method, it enters the waiting state It only enters the ready state after another thread invokes the object's notify() or notifyAll() methods
Correct Answer: Static member class is a class defined inside outer class with static modifier EX: Class A { //top level class or outer class static class B { //static member class } }
Correct Answer: Non-static member class is a class defined inside outer class with out static modifier EX: class A { // top level class or outer class class B { //non-static member class } }