There are different ways to create object in java as follows:–
1. Using new keyword
we can create the instance normally using new operator which is called as static instance creation.
Hello hello = new Hello();
we can create the instance dynamically without using new operator as follow
Class cls = Class.forName(“com.bikash.Hello”);
Hello hello = (Hello)cls.newInstance();
clone() method can be used to copy of the existing object.
Hello hello=new Hello();
4.using object deserialization.
deserializion is the process of creating the new object on the remote mechine from its serialize form.
ObjectInputStream ois =new ObjectInputStream();
Hello hello = (Hello)ois.readObject();