How many ways to create object in java?

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();

2.using Class.forName()
we can create the instance dynamically without using new operator as follow
Hello hello=(Hello)Class.forName("com.bikash.Hello").newInstance();
 Class cls = Class.forName("com.bikash.Hello");
Hello hello = (Hello)cls.newInstance();

3.using clone().
clone() method can be used to copy of the existing object.
Hello hello=new Hello();
Hello hello1=(Hello)hello.clone();

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();


  1. give me an explanation

  2. And this.getClass().getClassLoader().loadClass(“com.amar.myobject”).newInstance(); as well.

  3. here another blog is also good explaination ,Please go through this blog

  4. Here one more blog is there please visit it for better explanation.

  5. The blog gave me idea to create objects in java.The methods are explained with clarity which helped me understand the object creation easily
    Java Training in Chennai

  6. Replies
    1. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Java developer learn from Java Training in Chennai. or learn thru Java Online Training India . Nowadays Java has tons of job opportunities on various vertical industry.

  7. Good and informative post.... it is very useful for me to learn and understand as a initial professional.... keep rocks and updating...

    Java Training in chennai | Java Course in chennai

  8. Impressive and interesting article, thanks for sharing your information... keep rocks and updating...
    Best VLSI Project Center in Chennai | VLSI Project Center in Velachery

  9. Thank you for sharing the valuable information here. This was nice and please keep update like this valuable information..Diploma Projects Center in Chennai | Diploma Projects Center in Velachery

  10. Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge.

    MatLab Training Institute in Chennai | MatLab Training in Velachery | MatLab Courses in Medavakkam