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

How many bits is a 64 bit byte?

1140


What is a void in java?

1265


What methodology can be employed to locate substrings inside a string?

998


What is keyword in oop?

1006


What is constructor chaining and how is it achieved in java?

1239


Why char array is preferred over string for storing password?

1154


How to add menushortcut to menu item?

1040


What is the difference between heap and stack memory?

1246


Which is better stringbuffer or stringbuilder?

968


What is the null?

1060


How do you escape in java?

1137


What comes to mind when someone mentions a shallow copy in java?

1164


Difference between static binding and dynamic binding?

1183


How to implement an arraylist in java?

1254


Is it possible to write a regular expression to check if string is a number?

1074