Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How can u create the Object of class Without using "New"
opertor?

Answer Posted / giridhar gangapatnam

There are 4 ways to create object:

1.using new operator
Employee obj=new Employee();
Except this one

2.using factory methods
NumberFormat obj=NumberFormat.getNumberInstance();

3.using newInstance() method
Class c=Class.forName("Employee");
Employee obj=(Employee)c.newInstance();
or we can write these two lines as a single line
Employee obj=
(Employee)Class.forName("Employee").newInstance();

4.By cloning
Employee obj1=new Employee();
Employee obj2=(Employee)obj1.clone();

Is This Answer Correct ?    20 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

When is the finalize() called?

1166


Is java free for businesses?

1059


What is the inheritance?

969


What is meant by singleton class?

1029


What mechanism does java use for memory management?

968


What do you mean by scope of variable?

882


What will happen if a thrown exception is not handled?

1008


What is pangram in java?

1003


Can we override constructors in java?

1114


What is javac_g?

1007


What is java in simple terms?

989


What is classname class in java?

1049


What is the purpose of a volatile variable?

1022


How do you write a good declaration?

969


What are different types of classloaders?

1015