Dynamic loading

Can you explain how can we practically do dynamic loading?

Classloader and its method LoadClass() is used for dynamic loading of a class. It is an important feature of JVM as it provides facility to install software component at run time. It has number of characteristics like the classes are loaded on demand and it maintains the type safety of JVM.

For Example
public class loadClass
{
   public static void main(String args[])

   {

       ClassLoader classloader= loadClass.class.get ClassLoader()

       try

       {

           Class aClass= classloader.LoadClass(“com.program.MyClass”);

           System.out.println (“aClass.getName()=”+ aClass.getName());

       }

       catch(ClassNotFoundException e)

       {

           System.out.println(e);

       }

   }

}
Explain how to implement Shallow Cloning.
Shallow Cloning - Generally cloning means creating a new instance of a same class and copy all the fields to the new instance...
Explain how to implement Deep Cloning.
Deep Cloning - Deep cloning makes a distinct copy of each of object’s field...
Scheduling and Priority works in threads
Scheduling and Priority works in threads - Threads are assigned priorities that the thread scheduler can use to determine how the threads will be treated...
Post your comment