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 to create an instance of a class without using "new"
operator? Plz help me out properly.Thank u.

Answers were Sorted based on User's Feedback



How to create an instance of a class without using "new" operator? Plz help me out proper..

Answer / saravanan p

By using Class d=Class.forName("className");
Object obj=c.newInstance();

Is This Answer Correct ?    77 Yes 4 No

How to create an instance of a class without using "new" operator? Plz help me out proper..

Answer / b s vidyasagar reddy

three types
1.using factory methods
NumberFormat obj = NumberFormat.getNumberInstance();
2. using newInstance() method
class c = class.forName("Employee");
Employee obj = c.newInstance();
3. using coloning:
coloning is a way to create Bitwise exactcopy of an
existing object
Employee e2=e1.clone();

Is This Answer Correct ?    32 Yes 4 No

How to create an instance of a class without using "new" operator? Plz help me out proper..

Answer / satchidananda.lanka

Dynamic loading is a technique for programmatically
invoking the functions of a class loader at run time.

Let us look at how to load classes dynamically.

Class.forName (String className); //static method which
returns a Class
The above static method returns the class object associated
with the class name.
The string className can be supplied dynamically at run
time.
Once the class is dynamically loaded the following method
returns an instance of the loaded class. It’s just like
creating a class object with no
arguments.
class.newInstance (); //A non-static method, which creates
an instance of a
//class (i.e. creates an object).

Example as shown below ....

Test test = null ;
String myClassName = "com.test.DynamicLoadingClass" ;
Class testClass = Class.forName(myClassName) ;
test = (Test) testClass.newInstance();

Is This Answer Correct ?    10 Yes 3 No

How to create an instance of a class without using "new" operator? Plz help me out proper..

Answer / xxxx

with out new operater we can create object. Because the
String varible is taken as an object in java, which is
created with out new operater.
ex.
String str="xxxx";

Is This Answer Correct ?    8 Yes 3 No

How to create an instance of a class without using "new" operator? Plz help me out proper..

Answer / eswar

yes ....Class is a class which creates object
dynamically.....

Is This Answer Correct ?    10 Yes 7 No

How to create an instance of a class without using "new" operator? Plz help me out proper..

Answer / guest

by using class.forName();

Is This Answer Correct ?    4 Yes 1 No

How to create an instance of a class without using "new" operator? Plz help me out proper..

Answer / prakash sah

This is happening using reflection. Read reflection in java

Is This Answer Correct ?    3 Yes 1 No

How to create an instance of a class without using "new" operator? Plz help me out proper..

Answer / abhishek thakur

1. Four Ways of Object creation

i)Using "new" operator
ii)Using newInstance Method in Class.forName(class name)
iii)in case of deserialisation
iv)using clone

Is This Answer Correct ?    0 Yes 0 No

How to create an instance of a class without using "new" operator? Plz help me out proper..

Answer / vaibhav

Serialization and then deserialization will create a new
object without using "new" operator.

Is This Answer Correct ?    1 Yes 3 No

How to create an instance of a class without using "new" operator? Plz help me out proper..

Answer / arun kumar rout

In java without using new you can not create instance of a
class.

Is This Answer Correct ?    16 Yes 66 No

Post New Answer

More Core Java Interview Questions

In multi-threading how can we ensure that a resource isn't used by multiple threads simultaneously?

0 Answers  


Difference between ?System.out.println? and ?System.error.println??

8 Answers   Sai Softech,


What is the order of method invocation in an Applet?

1 Answers  


we r taking <load-on-startup>0</load-on-startup> <load-on-startup>1</load-on-startup> in deployment descripter for loading servlets like serv1 N serv2? so 'll it take serv1 or serv2

2 Answers   CSC,


What are the traverses in Binary Tree?

2 Answers   Adobe, Infosys,


What does void * mean?

0 Answers  


Write the algorithm to check the number non-leaf nodes in a tree.

0 Answers   Amdocs,


What is the difference between the paint() and repaint() methods in java programming?

0 Answers  


How is java created?

0 Answers  


What is Ideal Design of Class?

2 Answers  


For which statements we use a label?

3 Answers   Wipro,


What is one third plus one third as a fraction?

0 Answers  


Categories