Question-141. Explain the use of subclass in a Java Program ?

Answer- Sub class inherits all the public and protected methods and the implementation. It also inherits all the default modifier methods and their implementation.

Question-142. What is the Collections API ?

Answer- The Collections API is a set of classes and interfaces that support operations on collections of objects.

Question-143. The immediate superclass of Applet class ?

Answer- Panel is the immediate superclass. A panel provides space in which an application can attach any other component, including other panels.

Question-144. What is Garbage Collection ?

Answer- Garbage collection is a process of reclaiming the runtime unused objects.It is performed for memory management.

Question-145. What is gc()?

Answer- gc() is a daemon thread.gc() method is defined in System class that is used to send request to JVM to perform garbage collection.

Question-146. What is the purpose of finalize() method ?

Answer- finalize() method is invoked just before the object is garbage collected.It is used to perform cleanup processing.

Question-147. an unrefrenced objects be refrenced again ?

Answer- Yes.

Question-148. What kind of thread is the Garbage collector thread ?

Answer- Daemon thread.

Question-149. What is difference between final, finally and finalize ?

Answer-

final: final is a keyword, final can be variable, method or class.You, can't change the value of final variable, can't override final method, can't inherit final class.

finally: finally block is used in exception handling. finally block is always executed.

finalize():finalize() method is used in garbage collection.finalize() method is invoked just before the object is garbage collected.The finalize() method can be used to perform any cleanup processing.

 

Question-150. What is the purpose of the Runtime class ?

Answer- The purpose of the Runtime class is to provide access to the Java runtime system.