Java - Ways to create Java Object


Ways to Create Object:
·         Using new keyword
·         Using new instance
Class cls = Class.forName("TestExample");
TestExample obj = (TestExample) cls.newInstance();
·         Using Clone
CloneExample obj1 = new CloneExample();
CloneExample obj2 = (CloneExample) obj1.clone();

Comments

Popular posts from this blog

How to set Java Object into JaxBElement ?

GitLab