Sunday, August 17, 2014

CS2305 - PROGRAMMING PARADIGM - Unit 3

14 .What is the major difference between LinkedList and ArrayList? 

 LinkedList are meant for sequential accessing. ArrayList are meant for random accessing. 

15. What is nested class? 
If all the methods of a inner class is static then it is a nested class. 

 16. What is inner class? 
If the methods of the inner class can only be accessed via the instance of the inner class, then it is called inner class. 


 17. What is composition? 
 Holding the reference of the other class within some other class is known as composition. 

18. What is aggregation? 
It is a special type of composition. If you expose all the methods of a composite class and route the method call to the composite method through its reference, then it is called aggregation. 

19. What are the methods in Object? 
clone, equals, wait, finalize, getClass, hashCode, notify, notifyAll, toString 

21. Can you instantiate the Math class? 
You can’t instantiate the math class. All the methods in this class are static. And the constructor is not public. 


22. What is singleton? 
It is one of the design patterns. This falls in the creational pattern of the design pattern. There will be only one instance for that entire JVM. You can achieve this by having the private constructor in the class. For eg., public class Singleton { private static final Singleton s = new Singleton(); private Singleton() { } public static Singleton getInstance() { return s; } // all non static methods … } 

23. What is DriverManager? 
The basic service to manage set of JDBC drivers. 

24. What is Class.forName() does and how it is useful? 
 It loads the class into the ClassLoader. It returns the Class. Using that you can get the instance ( ―class-instance‖.newInstance() ). 

25. What is a DatabaseMetaData? 
 Comprehensive information about the database as a whole. 

No comments:

Post a Comment