Friday, August 15, 2014

CS 2305 PROGRAMMING PARADIGM - Unit 2

11. What is garbage collection? What is the process that is responsible for doing that in java?  
Reclaiming the unused memory by the invalid objects. Garbage collector is responsible for this process 

12. What kind of thread is the Garbage collector thread? - It is a daemon thread. 

13.What is a daemon thread? 
 These are the threads which can run without user intervention. The JVM can exit when there are daemon thread by killing them abruptly. 

14. How will you invoke any external process in Java?  
Runtime.getRuntime().exec(….) 

15. What is the finalize method do?
 Before the invalid objects get garbage collected, the JVM give the user a chance to clean up some resources before it got garbage collected. 



16. What is mutable object and immutable object? 
 If a object value is changeable then we can call it as Mutable object. (Ex., StringBuffer, …) If you are not allowed to change the value of an object, it is immutable object. (Ex., String, Integer, Float, …) 

17. What is the basic difference between string and stringbuffer object? 
 String is an immutable object. StringBuffer is a mutable object. 

18. What is the purpose of Void class? 
 The Void class is an uninstantiable placeholder class to hold a reference to the Class object representing the primitive Java type void. 

19. What is reflection? 
 Reflection allows programmatic access to information about the fields, methods and constructors of loaded classes, and the use reflected fields, methods, and constructors to operate on their underlying counterparts on objects, within security restrictions. 

20. What is the base class for Error and Exception? - Throwable

No comments:

Post a Comment