objects creation in java
In java objects are created in several ways they are
- using new operator
ex: Employe obj = new Employe(); - using factory methods
ex: NumberFormat obj = NumberFormat.getNumberInstance(); - using newInstance() method
ex: class c = class.forName(“Employe”);
Employe obj = c.newInstance(); - using cloning : creating bit wise exact copy of an object is called cloning
ex:Employe e1 = new Employe();
Employee e2 = e1.clone();
No comments:
Post a Comment