Project Management Professional: Core Java Interview Questions!

Tuesday, July 21, 2020

Core Java Interview Questions!

23.Why HashTable has been deprecated ?

 HashTable has been deprecated. As an alternative, ConcurrentHashMap has been provided. It uses multiple buckets to store data and hence much better performance than HashTable. Moreover, there is already a raw type HashMap.


24.Why do member variables have default values whereas local variables don't have any default value ?

member variable are loaded into heap, so they are initialized with default values when an instance of a class is created. In case of local variables, they are stored in stack until they are being used.

25.Difference between static vs. dynamic class loading?

static loading - Classes are statically loaded with Java new operator.


dynamic class loading - Dynamic loading is a technique for programmatically invoking the functions of a class loader at run time. 


26.Difference between static vs. dynamic class loading?


Ans. static loading - Classes are statically loaded with Java new operator.


dynamic class loading - Dynamic loading is a technique for programmatically invoking the functions of a class loader at run time. 


Class.forName (Test className);


27.What is PermGen or Permanent Generation ?


The memory pool containing all the reflective data of the java virtual machine itself, such as class and method objects. With Java VMs that use class data sharing, this generation is divided into read-only and read-write areas. The Permanent generation contains metadata required by the JVM to describe the classes and methods used in the application. The permanent generation is populated by the JVM at runtime based on classes in use by the application. In addition, Java SE library classes and methods may be stored here.



No comments: